#include <bits/stdc++.h>
using namespace std;
void print_pair(pair<int, int> a) {
  cerr << "(" << a.first << ", " << a.second << ") ";
}
template <int T1, int T2>
void print_2d(int a[T1][T2], int x, int y) {
  for (int i = 0; i < x; i++) {
    for (int j = 0; j < y; j++) {
      cerr << a[i][j] << " ";
    }
    cerr << endl;
  }
}
template <class T>
void print_array(T a[], size_t n) {
  cerr << "array:";
  for (int i = 0; i < n - 1; i++) cerr << a[i] << ",";
  cerr << a[n - 1] << endl;
}
int N;
int a[100];
pair<int, int> A[100];
int main() {
  cin >> N;
  for (int i = 0; i < N; i++) cin >> a[i];
  int means = 0;
  for (int i = 0; i < N; i++) means += a[i];
  for (int i = 0; i < N; i++) a[i] *= N;
  for (int i = 0; i < N; i++) {
    A[i] = make_pair(a[i], i);
  }
  sort(A, A + N);
  if (means == A[0].first) {
    cout << 0 << endl;
    return 0;
  }
  auto itr = lower_bound(A, A + N, make_pair(means, 0));
  itr--;
  if (itr->first - means < (itr + 1)->first - means) {
    itr = lower_bound(A, A + N, make_pair(itr->first, 0));
    cout << itr->second << endl;
  } else if (itr->first - means == (itr + 1)->first - means) {
    auto itr2 = itr + 1;
    itr = lower_bound(A, A + N, make_pair(itr->first, 0));
    cout << min(itr->second, itr2->second) << endl;
  } else {
    cout << (itr + 1)->second << endl;
  }
  return 0;
}
