#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int N;
  scanf("%d", &N);
  pair<int, int> List[N];
  int sm = 0;
  for (int i = 0; i < N; ++i) {
    scanf("%d", &List[i].first);
    List[i].second = i;
    sm += List[i].first;
  }
  sort(List, List + N);
  int res = 900, val = 100000;
  for (int i = 0; i < N; ++i) {
    int dist = abs(sm - N * List[i].first);
    if (dist < val) res = List[i].second, val = dist;
  }
  printf("%d\n", res);
  return 0;
}
