#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  int sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    a[i] *= n;
    sum += a[i];
  }
  int index = 0;
  int tmp = abs(a[index] - sum);
  for (int i = 1; i < n; i++) {
    if (abs(sum - a[i]) < tmp) {
      tmp = abs(sum - a[i]);
      index = i;
    }
  }
  cout << index << endl;
}
