using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string[] sS = System.Console.ReadLine().Trim().Split(' ');
            int iN = int.Parse(sS[0]);
            List<decimal> lstA = new List<decimal>();
            sS = System.Console.ReadLine().Trim().Split(' ');
            for (int i = 0; i < sS.Length; i++) { lstA.Add(decimal.Parse(sS[i])); }

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            decimal dAvg = (decimal)lstA.Average() * 1000000000M;
            List<ClsDev> lstD = new List<ClsDev>();
            for (int i = 0; i < lstA.Count; i++)
            {
                ClsDev oneUsr = new ClsDev();
                oneUsr.iX = i;
                oneUsr.iD = Math.Abs(lstA[i] *1000000000M - dAvg);
                lstD.Add(oneUsr);
            }
            lstD.Sort(delegate (ClsDev mca1, ClsDev mca2) { return (int)(mca1.iD - mca2.iD); });      // Dの昇順

            // 出力
            System.Console.WriteLine("{0}", lstD[0].iX.ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }

        private class ClsDev
        {
            public int    iX { get; set; } = 0;
            public decimal iD { get; set; } = 0M;
        }

}
