#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }
int main() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  double ave = 0;
  for (int i = 0; i < n; i++) {
    ave += a[i];
  }
  ave /= n;
  int mi[n];
  for (int i = 0; i < n; i++) {
    mi[i] = abs(ave - a[i]);
  }
  int ans_min = 100000;
  for (int i = 0; i < n; i++) {
    ans_min = min(ans_min, mi[i]);
  }
  for (int i = 0; i < n; i++) {
    if (ans_min == mi[i]) {
      cout << i << endl;
      return 0;
    }
  }
  return 0;
}
