#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 7;
const long long longinf = 1LL << 60;
constexpr char ln = '\n';
const int mx = 100010;
const long long mod = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  long double ave = 0;
  for (long long i = (int)(0); i < (int)(n); ++i) {
    cin >> a[i];
    ave += a[i];
  }
  ave /= n;
  int ans = -1;
  long double dis = inf;
  for (long long i = (int)(0); i < (int)(n); ++i) {
    if (abs(long double(a[i]) - ave) < dis) {
      ans = i;
    }
  }
  cout << ans << ln;
  return 0;
}
