#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  float ave = 0;
  cin >> N;
  int a[100];
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    ave += a[i];
  }
  ave /= N;
  float y = abs(a[0] - ave);
  int any = 0;
  for (int i = 1; i < N; i++) {
    float x = abs(ave - a[i]);
    if (x == y) {
      if (i < any) {
        y = x;
        any = i;
      }
    }
    if (x < y) {
      y = x;
      any = i;
    }
  }
  cout << any << endl;
  return 0;
}
