#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  double sum = 0;
  int a[n];
  int max = 10001;
  for (int i = 0; i < n; ++i) {
    int t;
    cin >> t;
    a[i] = t * n;
    sum += t;
  }
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    if (abs(a[i] - sum) < max) {
      ans = i;
      max = abs(a[i] - sum);
    }
  }
  cout << ans << endl;
  return 0;
}
