#include <bits/stdc++.h>
using namespace std;
void solve() {}
int main() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int sum = 0;
  for (int i = 0; i < n; i++) {
    sum += a[i];
  }
  int mean = sum / n;
  int min_width = INT_MAX;
  int min_num;
  for (int i = 0; i < n; i++) {
    if (abs(a[i] - mean) < min_width) {
      min_num = i;
      min_width = abs(a[i] - mean);
    }
  }
  cout << min_num << endl;
  return 0;
}
