#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  return b ? gcd(b, a % b) : a;
}
long long int lcm(long long int a, long long int b) {
  return a / gcd(a, b) * b;
}
const long long int MOD = 1e9 + 7;
const long long int INF = 1e10;
const long double PI = (acos(-1));
signed main() {
  long long int N;
  cin >> N;
  vector<long long int> a(N);
  double sum = 0;
  for (long long int i = 0; i < (long long int)(N); i++) {
    cin >> a[i];
    sum += a[i];
  }
  double ave = sum / N;
  sort(a.begin(), a.end());
  pair<double, long long int> mn = make_pair(INF, INF);
  for (long long int i = 0; i < (long long int)(N); i++) {
    double diff = abs(ave - a[i]);
    pair<double, long long int> p = make_pair(diff, i);
    mn = min(mn, p);
  }
  cout << mn.second << endl;
}
