#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9;
const int MOD = INF + 7;
const ll LINF = 1e18;
int main() {
  double N;
  cin >> N;
  vector<pair<int, int>> A(N);
  double ave = 0;
  for (int(i) = 0; (i) < (N); ++(i)) {
    int a;
    cin >> a;
    A[i] = {a, i};
    ave += a;
  }
  ave /= N;
  for (int(i) = 0; (i) < (N); ++(i)) A[i].first = abs(A[i].first - ave);
  sort(A.begin(), A.end());
  cout << A[0].second << endl;
}
