#include <bits/stdc++.h>
using namespace std;
constexpr long long INF = numeric_limits<long long>::max() / 2;
constexpr long long MOD = 1000000007;
using Graph = vector<vector<long long>>;
signed main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  long long N;
  cin >> N;
  long long a[N];
  long long sum = 0;
  for (long long i = 0; i < (long long)(N); i++) {
    cin >> a[i];
    sum += a[i];
  }
  long long b = 0, c = INF;
  for (long long i = 0; i < (long long)(N); i++) {
    if (abs(a[i] * N - sum) < c) {
      c = abs(a[i] * N - b);
      b = i;
    }
  }
  cout << b << endl;
}
