#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, sum = 0;
  cin >> n;
  vector<int> a(n);
  for (int& i : a) {
    cin >> i;
    sum += i;
  }
  int dif = abs(n * a[0] - sum), ans = 0;
  for (int i = 1; i < n; ++i) {
    if (dif > abs(n * a[i] - sum)) {
      ans = i;
      dif = n * a[i] - sum;
    }
  }
  cout << ans;
  return 0;
}
