#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;
int main() {
  int n;
  cin >> n;
  int sum = 0;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  int min_diff = INF, index;
  for (int i = 0; i < n; i++) {
    double diff = abs(sum / double(n) - a[i]);
    if (min_diff > diff) {
      min_diff = diff;
      index = i;
    }
  }
  cout << index << endl;
}
