#include <bits/stdc++.h>
using namespace std;
int asc(const void *a, const void *b) { return *(int *)a - *(int *)b; }
int desc(const void *a, const void *b) { return *(int *)b - *(int *)a; }
int main() {
  double n, average = 0;
  cin >> n;
  int a[(int)n], ans;
  for (int(i) = 0; (i) < (n); ++(i)) {
    cin >> a[i];
    average += a[i];
  }
  average = average / n;
  for (int(i) = 0; (i) < (n); ++(i)) {
    a[i] = abs(a[i] - average);
  }
  ans = 0;
  for (int(i) = 0; (i) < (n); ++(i))
    if (a[ans] > a[i]) ans = i;
  cout << ans << endl;
  return 0;
}
