#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];
    sum += a[i];
  }
  int idx = -1;
  int mi = 1e9;
  int v = 1e9;
  for (int i = 0; i < n; ++i) {
    int diff = abs(sum - (n * a[i]));
    if ((diff == mi && a[i] < v) || diff < mi) {
      mi = diff;
      v = a[i];
      idx = i;
    }
  }
  cout << idx << '\n';
  return 0;
}
