#include <bits/stdc++.h>
using namespace std;
int main(int argc, char* argv[]) {
  int n;
  cin >> n;
  vector<pair<long long, int> > array;
  long long sum = 0;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    array.push_back(make_pair(a, i));
    sum += a;
  }
  sort(array.begin(), array.end());
  pair<long long, int> best = make_pair(LLONG_MAX, -1);
  for (int i = 0; i < n; i++) {
    long long dist = abs(array[i].first * n - sum);
    if (dist < best.first) {
      best = make_pair(dist, array[i].second);
    }
  }
  cout << best.second << endl;
  return 0;
}
