#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ld INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }



int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(25);

  int n;
  cin >> n;
  vector<ld> a(n);
  rep(i, n) cin >> a[i];

  ld ave = 0;
  rep(i, n) ave += a[i];
  ave /= n;
  int ans = -1;
  ld res = INF;
  rep(i, n) if (chmin(res, fabs(a[i] - ave))) ans = i;
  cout << ans << '\n';


  
  return 0;
}
#include <bits/stdc++.h>
using namespace std;
#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
int main(void){
	int N;
  	cin >> N;
  	vector<pair<float, int>> vec(N);
  	float avg = 0.0f;
  	rep(i,0,N){
      	int input;
      	cin >> input;
      	vec[i] = make_pair(input, i);
      	avg+=(float)vec[i].first;
    }
  	avg/=N;
  	float minimum  = vec[0].first;
  	rep(i,0,N){
      	vec[i].first = abs(vec[i].first- avg);
      	if (minimum > vec[i].first)
          	minimum = vec[i].first;
    }
  	rep(i,0,N){
      	if ( minimum == vec[i].first){
    		cout << i << endl; 
          	return 0;
      	}
    }
}
        	