#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int sum = 0;
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    int n;
    cin >> n;
    vec.at(i) = n;
    sum += n;
  }
  int a = sum / N;
  vector<int> vec2(N);
  for (int i = 0; i < N; i++)
    if (vec.at(i) >= a)
      vec2.at(i) = vec.at(i) - a;
    else
      vec2.at(i) = a - vec.at(i);
  int x = vec2.at(1);
  int y = 0;
  for (int i = 0; i < N; i++)
    if (vec2.at(i) < x) {
      x = vec2.at(i);
      y = i;
    }
  cout << y << endl;
}
