#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const long long MOD = 1e9 + 7;
const int INF = 1 << 30;
int main() {
  double N;
  cin >> N;
  vector<double> v(N);
  for (int i = 0; i < (int)(N); i++) cin >> v[i];
  double heikin = 0;
  for (int i = 0; i < (int)(N); i++) heikin += v[i] / N;
  vector<double> res(N);
  for (int i = 0; i < (int)(N); i++) res[i] = abs(v[i] - heikin);
  int ans = 0;
  int cnt = INF;
  for (int i = 0; i < (int)(N); i++) {
    if (res[i] < cnt) {
      cnt = res[i];
      ans = i;
    }
  }
  cout << ans << endl;
}
