#include <bits/stdc++.h>
using ll = long long;
constexpr ll INF = 10000000000;
constexpr ll MOD = 1000000007;
const int MAX_N = 110000;
constexpr double EPS = 1E-11;
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<double> a(n);
  for (int i = 0; i < (n); i++) cin >> a[i];
  double sum = 0;
  for (int i = 0; i < (n); i++) {
    sum += a[i];
  }
  double avr = sum / n;
  vector<int> av(n);
  int ans = INF;
  int x = 0;
  for (int i = 0; i < (n); i++) {
    double now = abs(a[i] - avr);
    av[i] = now;
    if (now < ans && now != ans) {
      x = i;
    }
  }
  sort((av).begin(), (av).end());
  cout << x << endl;
}
