#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e+18 + 1;
const long long MOD = 1000000007LL;
string abc = "abcdefghijklmnopqrstuvwxyz";
string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < (long long)(n); i++) cin >> a[i];
  double ave = 0;
  for (long long i = 0; i < (long long)(n); i++) ave += a[i];
  ave /= n;
  long long MIN = INF;
  long long k = -1;
  for (long long i = 0; i < (long long)(n); i++) {
    if (abs(ave - a[i]) < MIN) {
      k = i;
      MIN = abs(ave - a[i]);
    }
  }
  cout << k << endl;
}
