#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < (int)(N); i++) {
    cin >> a[i];
  }
  double b = accumulate(a.begin(), a.end(), 0) / (double)N;
  int ans = 0;
  int c = INT_MAX;
  for (int i = 0; i < (int)(N); i++) {
    double d = abs(a[i] - b);
    if (c > d) {
      c = d;
      ans = i;
    }
  }
  cout << ans << endl;
  return 0;
}
