using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;

class Program
{
    static void Main(string[] args)
    {
        var num = ToInt32(ReadLine());
        var ar = Array.ConvertAll(ReadLine().Split(' '), int.Parse);
        var ave = ar.Sum() / num;
        var min = int.MaxValue;
        var mini = -1;
        for(var i = 0; i < num; i++)
        {
            if (min > Abs(ave - ar[i])){
                min = Abs(ave-ar[i]);
                mini = i;
            }
        }
        WriteLine(mini);
    }

    private const string ALFA = "abcdefghijklmnopqrstuvwxyz";
    private const int MOD = 1000000007;
}
