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