#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  double sum = 0;
  for (int(i) = 0; (i) < (n); (i)++) {
    cin >> a[i];
    sum += a[i];
  }
  double ave = sum / (double)n;
  int ans = 0;
  int mn = INF;
  int pos = 0;
  for (int(i) = 0; (i) < (n); (i)++) {
    int dx = abs(ave - a[i]);
    if (mn > dx) {
      mn = dx;
      pos = i;
    }
  }
  cout << pos << endl;
}
