#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n];
  int sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  double ave = sum / n;
  double diff = 1000;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (abs(a[i] - ave) < diff) {
      ans = i;
      diff = abs(a[i] - ave);
    }
  }
  cout << ans << endl;
}
