#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
const int MOD = 1e9 + 7;
const ll INF = 2e15;
template <class T>
void print(const T& t) {
  cout << t << endl;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int main() {
  ll n;
  cin >> n;
  vector<Pll> a;
  ll sum = 0;
  for (ll i = 0; i < (ll)(n); i++) {
    ll m;
    cin >> m;
    a.push_back(make_pair(m, i));
    sum += m;
  }
  ll ans = 0;
  ll mini = INF;
  sort(a.begin(), a.end());
  for (ll i = 0; i < (ll)(n - 1); i++) {
    ll x = abs(a[i].first * n - sum);
    if (x < mini) {
      ans = a[i].second;
      mini = x;
      break;
    }
  }
  print(ans);
}
