#include <bits/stdc++.h>
using namespace std;
long long dp[1500][1500], xmin, ymin;
long long solve() {
  long long n, s = 0;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; i++) cin >> a[i], s += a[i];
  float cl = 1e9, num = s / n, in;
  for (long long i = 0; i < n; i++) {
    if (abs(a[i] * (1.0) - num) < cl) in = i, cl = abs(a[i] - num);
  }
  cout << in << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  solve();
}
