#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  long long sum = 0;
  for (int i = (0); i < (int)(n); i++) {
    cin >> a[i];
    sum += a[i];
  }
  long long ave = (double)sum / n;
  int num = a[0], idx = 0;
  for (int i = (0); i < (int)(n); i++) {
    if (abs(ave - a[i]) < abs(ave - num)) {
      num = a[i];
      idx = i;
    }
  }
  cout << idx << endl;
  return 0;
}
