#include <bits/stdc++.h>
using namespace std;
void solve() {
  int N;
  cin >> N;
  vector<int> a(N);
  int sum = 0;
  for (int i = 0; i < N; ++i) {
    cin >> a[i];
    sum += a[i];
  }
  double ave = (double)sum / N;
  int minIndex = 0;
  int minVal = 1e9;
  for (int i = 0; i < N; ++i) {
    if (minVal > abs(ave - a[i])) {
      minVal = abs(ave - a[i]);
      minIndex = i;
    }
  }
  cout << minIndex << endl;
}
int main() {
  solve();
  return (0);
}
