#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1 << 29;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>
void print(T t) {
  for (auto& it : t) cout << it << " ";
}
inline long long powerexp(long long a, long long b, long long m = MOD) {
  long long res = 1;
  while (b) {
    if (b & 1) res = res * a % m;
    a = a * a % m, b >>= 1;
  }
  return res % m;
}
void solve() {
  long long n, sum = 0, mean;
  cin >> n;
  vector<long long> v(n);
  for (auto& it : v) {
    cin >> it;
    sum += it;
  }
  mean = sum / n;
  long long ans = 0;
  for (long long i = 1; i < n; i++) {
    if (abs(v[i] - mean) < abs(v[ans] - mean)) ans = i;
  }
  cout << ans << '\n';
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  ;
  solve();
}
