#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  for (long long i = 0; i < (N); i++) {
    cin >> a[i];
  }
  double avg = 0;
  for (long long i = 0; i < (N); i++) {
    avg += a[i];
  }
  avg /= N;
  int ans;
  int res = 1e9;
  for (long long i = 0; i < (N); i++) {
    if (abs(a[i] - avg) < res) {
      ans = i;
      res = abs(a[i] - avg);
    }
  }
  for (long long i = 0; i < (N); i++) {
    if (abs(a[ans] - avg) == res) {
      cout << i << endl;
      return 0;
    }
  }
  return 0;
}
