using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var input = Console.ReadLine().Split(' ');
            var flames = new List<int>();

            foreach (var item in input)
            {
                flames.Add(int.Parse(item));
            }

            var ave = flames.Average();

            int? min = null;
            var flamePoint = 0;
            var i = 0;

            foreach (var flame in flames)
            {
                if (min == null)
                {
                    min = (int)Math.Abs(flame - ave);
                }
                else
                {
                    if ((int)Math.Abs(flame - ave) < min)
                    {
                        min = flame;
                        flamePoint = i;
                    }
                }

                i++;
            }

            Console.WriteLine(flamePoint);
        }
    }
}
