#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int n;
  cin >> n;
  vector<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];
  }
  sum /= n;
  int min = a[0] - sum;
  int u = 0;
  if (min < 0) {
    min = -min;
  }
  for (int i = 1; i < n; i++) {
    int k = a[i] - sum;
    if (k < 0) {
      k = -k;
    }
    if (min > k) {
      u = i;
    }
  }
  cout << u << endl;
}
