#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1000000007;
void solve() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < (n); ++i) cin >> a[i];
  double ave = 0;
  for (int i = 0; i < (n); ++i) ave += a[i];
  ave /= n;
  int sub = 2147483647, ans = 0;
  for (int i = 0; i < (n); ++i) {
    double b = abs(ave - a[i]);
    if (b < sub) {
      sub = b;
      ans = i;
    }
  }
  std::cout << (ans) << "\n";
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  cout << fixed << setprecision(12);
  solve();
}
