#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n];
  int sum = 0;
  double ave = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  ave = double(sum / n);
  double ans = 1000000;
  int tmp = 0;
  for (int i = 0; i < n; i++) {
    if (ans > abs(ave - a[i])) {
      ans = ave - a[i];
      tmp = i;
    }
  }
  cout << tmp << endl;
  return 0;
}
