#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, dif = 10000000, x = 0;
  double s = 0;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < (n); i++) {
    cin >> a[i];
    s += a[i];
  }
  s /= n;
  for (int i = 0; i < (n); i++) {
    if (abs(a[i] - s) < dif) {
      dif = abs(a[i] - s);
      x = i;
    }
  }
  cout << x << endl;
  return 0;
}
