static class Program
{
    static void Main()
    {
        ReadLine();
        int[] input = ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();

        decimal average = GetAverage(input);
        if (input.Any(n => n == (int)average))
        {
            WriteLine(Array.IndexOf(input, (int)average));
        }
        else
        {
            decimal min = input.Select(n => Math.Abs(n - average)).Min();
            int result = input.First(n => Math.Abs(n - average) == min);
            WriteLine(Array.IndexOf(input, result));
        }

        ReadKey();
    }

    static decimal GetAverage(IEnumerable<int> a)
    {
        return (decimal)a.Sum() / a.Count();
    }
}