#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000000;
const long long INFL = 1LL << 50;
const long long mod = 1000000007;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  double res = 0;
  for (int i = 0; i < int(n); i++) {
    int b;
    cin >> b;
    res += b;
    a[i] = b;
  }
  res /= n;
  int ans, c = INF;
  for (int i = 0; i < int(n); i++) {
    if (abs(res - a[i]) < c) {
      ans = i;
      c = abs(res - a[i]);
    }
  }
  cout << ans << endl;
  return 0;
}
