#include <bits/stdc++.h>
using namespace std;
string char_to_str(char c) {
  string tem(1, c);
  return tem;
}
signed main() {
  long long n;
  cin >> n;
  long long a[n];
  long long s = 0;
  for (long long i = 0; i < n; ++i) {
    cin >> a[i];
    s += a[i];
    a[i] *= n;
  }
  long long m = abs(s - a[0]), po = 0;
  for (long long i = 1; i < n; ++i) {
    if (abs(s - a[i]) < m) {
      po = i;
      m = abs(s - a[i]);
    }
  }
  cout << po;
}
