#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
  cin.tie(0);
  cin.sync_with_stdio(0);

  int n;
  cin >> n;
  int sum = 0;
  vector<int> a(n);
  for (auto& x : a) cin >> x, sum += x;

  double avg = 1.0 * sum / n;

  int ans = 0;
  for (int i = 1; i < n; ++i)
    if (abs(avg - a[i]) < abs(avg - a[ans])) ans = i;
  cout << ans;
}