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