#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int INF = 1e9;
long gcd(long a, long b) { return b == 0 ? a : gcd(b, a % b); }
long lcm(long m, long n) {
  if ((0 == m) || (0 == n)) return 0;
  return ((m / gcd(m, n)) * n);
}
int main() {
  int N;
  cin >> N;
  std::vector<pair<int, int>> a;
  std::vector<pair<int, double>> a_abs;
  int sum = 0;
  for (int i = 0; i < N; i++) {
    int a_;
    cin >> a_;
    a.push_back(make_pair(i, a_));
    sum += a_;
  }
  double avg = ((double)sum) / N;
  for (int i = 0; i < N; i++) {
    double temp = (double)a[i].second;
    a_abs.push_back(make_pair(abs(temp - avg), i));
  }
  sort(a_abs.begin(), a_abs.end());
  cout << a_abs[0].second << endl;
  return 0;
}
