using System;
 
public class AtCoder
{
    public static void Main()
    {
        int n;
        n = int.Parse(Console.ReadLine().Trim());
        string[] s;
        s = Console.ReadLine().Trim().Split(' ');
        int[] a = new int[n];
        double avg = 0;
        for (int i = 0; i < n; i++)
        {
            a[i] = int.Parse(s[i]);
            avg = avg + a[i];
        }
        avg = avg / n;
        double m, ans;
        m = 10000000;
        for (int i = 0; i < n; i++)
        {
            m = Math.Min(m, (double)Math.Abs(avg - a[i]));
            
        }
        ans = -1;
        int j = 0;
        while (ans == -1)
        {
          	k = avg - a[j];
          	if(k<0) k = -k;
            if (k == m) ans = j;
            j++;
        }
 
 
            Console.WriteLine(ans);
    }
}