#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const double PI = acos(-1.0);
const long long MOD = 1e9 + 7;
int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  double p = 0.0;
  for (int i = 0; i < N; i++) {
    p += a[i] * 1.0;
  }
  p /= 1.0 * N;
  int res = -1;
  int diff = INF;
  for (int i = 0; i < N; i++) {
    if (diff > abs(p - a[i])) {
      diff = p - 1.0 * a[i];
      res = i;
    }
  }
  cout << res << endl;
  return 0;
}
