#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n];
  int all;
  int num = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    all += a[i];
  }
  int b = a[0] * n - all;
  if (b < 0) {
    b *= -1;
  }
  int c;
  for (int i = 1; i < n; i++) {
    c = a[i] * n - all;
    if (c < 0) {
      c *= -1;
    }
    if (c < b) {
      num = i;
      b = c;
    }
  }
  cout << num << endl;
}
