#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long INF = 1e16;
const long long MAX_N = 100010;
int main() {
  long long n;
  cin >> n;
  vector<double> a(n);
  double sum = 0;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  double ave = sum / n;
  vector<pair<long long, long long>> p(n);
  for (long long i = 0; i < n; i++) {
    p[i] = make_pair(abs(ave - a[i]), i);
  }
  sort(p.begin(), p.end());
  cout << p[0].second << endl;
  return 0;
}
