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