#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 abs(int x) { return x > 0 ? x : -x; }
int absf(double x) { return x > 0 ? x : -x; }
int main() {
  int n;
  cin >> n;
  int a[n];
  double avr = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    avr += a[i];
  }
  avr /= n;
  double min = 1000;
  int index;
  for (int i = n - 1; i >= 0; i--) {
    if (min >= absf(a[i] - avr)) {
      min = absf(a[i] - avr);
      index = i;
    }
  }
  cout << index << endl;
}
