#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
int main() {
  int n;
  cin >> n;
  vector<double> a(n);
  double sum = 0;
  for (int i = 0; i < (n); i++) cin >> a[i], sum += a[i];
  double avg = sum / n;
  int ans = 0;
  for (int i = (1); i < (n); i++) {
    if (abs(a[i] - avg) < abs(a[ans] - avg)) ans = i;
  }
  cout << ans << endl;
  return 0;
}
