#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int sum = 0;
  vector<int> A;
  for (long long i = 0; i < n; i++) {
    int a;
    cin >> a;
    A.push_back(a);
    sum += a;
  }
  int hei = sum / n;
  int ans = -1;
  int dis = 10000;
  for (long long i = 0; i < n; i++) {
    if (abs(A[i] - hei) < dis) {
      ans = i;
      dis = abs(A[i] - hei);
    }
  }
  cout << ans << endl;
}
