#include <bits/stdc++.h>
using namespace std;
long long int mod = 1e9 + 7;
template <class T>
void inputV(vector<T> &x, int n) {
  for (int i = 0; i < n; i++) cin >> x[i];
}
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  int s = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    s += a[i];
  }
  double ave = s * 1.0 / n;
  int p = 0;
  double d = abs(a[0] - ave);
  for (int i = 0; i < n; i++) {
    double dd = abs(a[i] - ave);
    if (dd < d) {
      p = i;
    }
  }
  cout << p << endl;
  return 0;
}
