#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, a;
  double sum = 0.0;
  vector<int> As;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> a;
    As.push_back(a);
    sum += a;
  }
  sum /= N;
  int minval = 100000;
  int ans = 0;
  for (int i = 0; i < N; i++) {
    if (minval > abs(As[i] - sum)) {
      minval = abs(As[i] - sum);
      ans = i;
    }
  }
  cout << ans << endl;
  return 0;
}
