#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N;
  double ave = 0;
  vector<pair<double, long long>> V;
  cin >> N;
  for (int i = 0; i < (int)N; ++i) {
    pair<double, long long> pa;
    cin >> pa.first;
    pa.second = i;
    V.push_back(pa);
    ave = ave + pa.first;
  }
  ave = ave / N;
  for (int i = 0; i < (int)N; ++i) {
    V[i].first = abs(ave - V[i].first);
  }
  sort(V.begin(), V.end());
  cout << V[0].second << endl;
}
