#include <bits/stdc++.h>
using namespace std;
int n;
int a[111];
int main() {
  ios_base::sync_with_stdio(false);
  int ave = 0;
  int ans = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    a[i] *= 10;
    ave += a[i];
  }
  ave /= n;
  for (int i = 1; i < n; i++) {
    if (abs(a[i] - ave) < abs(a[ans] - ave)) {
      ans = i;
    } else if (abs(a[i] - ave) == abs(a[ans] - ave) && a[i] < a[ans]) {
      ans = i;
    }
  }
  cout << ans << endl;
  return 0;
}
