#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  long long n, ave = 0, ans = 0;
  cin >> n;
  vector<long long> a(n, 0);
  for (long long(i) = 0; i < (n); ++(i)) {
    cin >> a[i];
    ave += a[i];
  }
  ave /= n;
  for (long long(i) = 0; i < (n); ++(i)) a[i] = abs(a[i] - ave);
  ans = min_element(a.begin(), a.end()) - a.begin();
  cout << (ans) << endl;
  return 0;
}
