#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long INF = 1e18;
const double pi = acos(-1.0);
int main(void) {
  long long n;
  cin >> n;
  vector<long long> a(n);
  long long sum = 0;
  for (long long i = 0; i < (n); ++i) {
    cin >> a[i];
    sum += a[i];
  }
  double ave = sum / n;
  long long ans = 0;
  double tmp = INF;
  for (long long i = 0; i < (n); ++i) {
    if (abs(ave - a[i]) < tmp) {
      ans = i;
      tmp = abs(ave - a[i]);
    }
  }
  cout << ans << endl;
  return 0;
}
