#include <bits/stdc++.h>
using namespace std;
long long BigMod(long long int a, long long int b, int M) {
  long long remainder, answer = 1;
  remainder = a % M;
  while (b != 0) {
    if (b % 2 == 1) answer = (answer * remainder) % M;
    remainder = (remainder * remainder) % M;
    b /= 2;
  }
  return answer;
}
bool cmp(int a, int b) { return a > b; }
int main() {
  int n, sum = 0;
  cin >> n;
  int a[n + 2];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  double avg = sum / (double)n;
  int indx = 0;
  double mn = 0;
  for (int i = n - 1; i >= 0; i--) {
    if (abs(avg - a[i]) <= mn) {
      mn = abs(avg - a[i]);
      indx = i;
    }
  }
  cout << indx << endl;
  return 0;
}
