#include <bits/stdc++.h>
using namespace std;
long long n, i, j, ans = 0;
long long a[1000000];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  long long sum = 0;
  cout << fixed << setprecision(15);
  for (i = 1; i <= n; i++) cin >> a[i], sum += a[i];
  long double avg = sum / n;
  long double Max = INT_MAX;
  vector<pair<long double, long long> > v;
  for (i = 1; i <= n; i++) {
    v.push_back({abs(avg - a[i]), i - 1});
  }
  sort(v.begin(), v.end());
  ans = v[0].second;
  for (i = 1; i < v.size(); i++) {
    if (v[i].first == v[0].first and v[i].second < ans) ans = v[i].second;
  }
  return cout << ans, 0;
}
