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

namespace ドワンゴ5th
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
            double[] b = new double[n];
            int[] c = new int[n];
            List<int> index = new List<int>();
            double sum = 0, ave = 0;
            for (int i = 0; i < n; i++)
            {
                sum += a[i];
                c[i] = i;
            }
            ave = sum / n;
            for (int i = 0; i < n; i++)
            {
                b[i] = Math.Max(ave - a[i], -ave + a[i]);
            }
            Array.Sort(b, c);
            Console.WriteLine(c[0]);
        }
    }
}
