#include <bits/stdc++.h>
using namespace std;
int main() {
  int ans = 0;
  int m = 1000000;
  int N;
  int sum = 0;
  int a[N];
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    sum += a[i];
  }
  for (int i = 0; i < N; i++) {
    if (abs(sum - a[i] * N) < m) {
      m = abs(sum - a[i] * N);
      ans = i;
    }
  }
  cout << ans << endl;
  return 0;
}
