#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, gokei = 0, temp = 1000000, ans = 0;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    gokei += a[i];
  }
  for (int i = 0; i < n; i++) {
    if (temp > abs(gokei - n * a[i])) {
      ans = i;
      temp = gokei - n * a[i];
    }
  }
  cout << ans << endl;
}
