#include <bits/stdc++.h>
using namespace std;
long long dy[] = {-1, 0, 1, 0};
long long dx[] = {0, 1, 0, -1};
signed main() {
  long long n, ans = 1e9, idx;
  cin >> n;
  double a[n], sum = 0;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  sum /= n;
  for (long long i = 0; i < n; i++) {
    double x = abs(a[i] - sum);
    if (ans > x) {
      ans = x;
      idx = i;
    }
  }
  cout << idx << endl;
}
