#include <bits/stdc++.h>
using namespace std;
constexpr int MOD = 1000000007;
template <class T = int>
T in() {
  T x;
  cin >> x;
  return (x);
}
template <class T = int>
void out(T x) {
  cout << (x) << '\n';
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
void solve() {
  int N = in();
  vector<pair<int, int> > a;
  double sum = 0;
  for (int i = 0; i < N; i++) {
    int tmp;
    cin >> tmp;
    a.push_back(make_pair(tmp, i));
    sum += tmp;
  }
  sum /= N;
  for (int i = 0; i < N; i++) {
    a[i].first = abs(a[i].first - sum);
  }
  int ans = 0;
  double min = (1e9);
  for (int i = 0; i < N; i++) {
    if (min > a[i].first) {
      ans = i;
      min = a[i].first;
    }
  }
  cout << ans << '\n';
  return;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
  return 0;
}
