#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<double> a(n);
  vector<pair<double, int>> d(n);
  int sum{};
  double avg{};
  for (int i = (0); i < (n); ++i) {
    int in;
    cin >> in;
    a[i] = in;
    sum += in;
  }
  avg = sum / n;
  for (int i = (0); i < (n); ++i) {
    d[i] = make_pair(a[i] - avg, i);
    if (d[i].first < 0) d[i].first *= -1;
  }
  sort(d.begin(), d.end());
  cout << d[0].second << endl;
}
