#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int N;
  cin >> N;
  vector<int> a(N, 0);
  for (int i = 0; i < (N); ++i) {
    cin >> a[i];
  }
  double sum = 0.0;
  for (int i = 0; i < (N); ++i) {
    sum += (double)a[i];
  }
  sum /= (double)N;
  int res = -1;
  double ans = ((double)(1e9));
  for (int i = 0; i < (N); ++i) {
    int curr = abs((double)a[i] - sum);
    if (curr < ans) {
      ans = curr;
      res = i;
    }
  }
  cout << res << endl;
  return 0;
}
