#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> v(n, 0);
  double average = 0.0;
  for (int i = 0; i < n; i += 1) {
    cin >> v[i];
    average += v[i] / (n + 0.0);
  }
  int who = -1;
  double best = 1e8;
  for (int i = 0; i < n; i += 1) {
    if (abs(v[i] - average) < best) {
      best = abs(v[i] - average);
      who = i;
    }
  }
  cout << who << "\n";
}
