#include <bits/stdc++.h>
using namespace std;
int main() {
  float min_sa = 100000;
  int n, sum, ans, b = 0;
  float avg, c, sa = 0;
  cin >> n;
  float a[n];
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    sum += a[i];
  }
  avg = sum / n;
  for (int j = 0; j < n; ++j) {
    c = a[j] - avg;
    sa = abs(c);
    if (min_sa > sa) {
      min_sa = sa;
      b = j;
    }
  }
  cout << b << endl;
}
