//************************
//*  Date: 2018.11.25    *
//*  Problem:            *
//*  Author: xuziyuan    * 
//************************

#include <bits/stdc++.h>

#define rt0 return 0
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define replet(c) for(char c='a';c<='z';c++)
#define LL long long
#define pii pair <int,int>
#define pb push_back
#define fi first
#define se second
#define mpr make_pair
#define sqr(a) ((a)*(a))

using namespace std;

const LL MOD=1e9+7;

int n,a[110],sum=0,ans;

inline pii yuefen(pii a)
{
	int p=__gcd(a.fi,a.se);
	return {a.fi/p,a.se/p};
}

inline pii minu(pii a,pii b)
{
	int aa=a.se,bb=b.se;
	a.fi*=bb;
	b.fi*=aa;
	a.se*=bb;
	b.se*=aa;
	return yuefen({abs(max(a.fi,b.fi)-min(a.fi,b.fi)),a.se});
}

inline bool sm(pii sma,pii bi)
{
	return (sma.fi*bi.se)<(bi.fi*sma.se);
}

int main()
{
	cin>>n;
	rep(i,n) cin>>a[i],sum+=a[i];
	pii av=yuefen({sum,n});
	pii mn={1e9,1};
	//cout<<av.fi<<'/'<<av.se<<endl<<endl;
	rep(i,n)
	{
		pii res=minu(av,{a[i],1});
		//cout<<res.fi<<'/'<<res.se<<endl;
		if(sm(res,mn))
		{
			mn=res;
			ans=i;
		}
	}
	cout<<ans<<endl;
	rt0;
}