#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define fi first
#define se second
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define REP(i, n) FOR(i, 0, n)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define RREP(i, n) FOR(i, n, 0)
#define MFOR(i, m) for(auto i=(m).begin();i!=(m).end();i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())

typedef long long int ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;

const double eps = 1e-10;
const int MOD = 1000000007;

void printv(vector<auto> const& s) {
  REP(i, s.size()) {
    cout << s[i] << endl;
  }
}

void print(auto const s) {
  cout << s << endl;
}

int main () {
  cin.tie(0);
  cout << setprecision(10);

  int n; cin >> n;
  int mean = 0;
  vi a(n);
  REP(i, n) {
    cin >> a[i];
    mean += a[i];
  }
  mean /= n;
  P p;
  p.fi = abs(mean - a[0]);
  p.se = 0;
  FOR(i, 1, n) {
    if(p.fi > abs(mean - a[i])) {
      p.fi = abs(mean - a[i]);
      p.se = i;
    }
  }

  print(p.se);
}
