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