#include <bits/stdc++.h>
using namespace std;
const int IINF = 1e9 + 10;
const long long LLINF = (long long)1e18 + 10;
const long long MOD = (long long)1e9 + 7;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1},
          dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
int main() {
  int n;
  cin >> n;
  vector<double> a(n);
  double ave = 0;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    ave += a[i];
  }
  ave /= (double)n;
  int ans = 0, dif = abs(ave - a[0]);
  for (int i = 0; i < n; ++i) {
    if (abs(ave - a[i]) < dif) {
      ans = i;
      dif = abs(ave - a[i]);
    }
  }
  cout << ans << endl;
  return 0;
}
