#include <bits/stdc++.h>
using namespace std;
int main() {
  int N = 0;
  cin >> N;
  vector<vector<int>> a;
  float ai = 0;
  a.resize(N);
  for (int i = 0; i < N; ++i) {
    a[i].resize(2);
    a[i][1] = i;
    cin >> a[i][0];
    ai += a[i][0];
  }
  ai /= N;
  for (int i = 0; i < N; ++i) {
    a[i][0] = abs(a[i][0] - ai);
  }
  for (int i = 0; i < N - 1; ++i) {
    if (a[0][0] > a[i + 1][0]) {
      a[0][0] = a[i + 1][0];
      a[0][1] = a[i + 1][1];
    }
  }
  cout << a[0][1] << endl;
  system("pause");
  return 0;
}
