#include <bits/stdc++.h>
using namespace std;
const long long inf = LLONG_MAX;
const long double pi = M_PI;
void Yes() { cout << "Yes" << '\n'; }
void No() { cout << "No" << '\n'; }
void YES() { cout << "YES" << '\n'; }
void NO() { cout << "NO" << '\n'; }
int main() {
  long long n;
  cin >> n;
  vector<vector<long long> > a(n, vector<long long>(2));
  double avg = 0;
  for (long long i = 0; i < n; i++) {
    cin >> a[i][0];
    avg += a[i][0];
    a[i][1] = i;
  }
  avg /= n;
  long long m = -1;
  sort((a).begin(), (a).end());
  for (long long i = 0; i < n; i++) {
    if (a[i][0] == avg) {
      cout << a[i][1] << '\n';
      return 0;
    }
    if (a[i][0] > avg) {
      while (i > 0 && a[i][0] == a[i - 1][0]) i--;
      m = i;
      break;
    }
  }
  if (m == -1) {
    long long x = n - 1;
    while (x > 0 && a[x][0] == a[x - 1][0]) x--;
    cout << a[x][1] << '\n';
  } else if (m == 0)
    cout << a[0][1] << '\n';
  else {
    if (a[m][0] - avg < avg - a[m - 1][0])
      cout << a[m][1] << '\n';
    else {
      long long x = m - 1;
      while (x > 0 && a[x][0] == a[x - 1][0]) x--;
      cout << a[x][1] << '\n';
    }
  }
}
