#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<double> a(n);
  double sum = 0;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    sum += a[i];
  }
  double ave = sum / n;
  int idx = -1;
  double dist = 1e9;
  for (int i = 0; i < n; ++i) {
    double diff = a[i] - ave;
    if ((abs(diff) == abs(dist) && diff < dist) || abs(diff) < abs(dist)) {
      dist = diff;
      idx = i;
    }
  }
  cout << idx << '\n';
  return 0;
}
