using System;
using System.Collections.Generic;
using System.Linq;

namespace Dwango_Thumbnail
{
	internal class Program
	{
		public static void Main(string[] args)
		{
			int n = int.Parse(Console.ReadLine());
			string[] input = Console.ReadLine().Split(' ');
			List<double> alist = new List<double>();

			for (int i = 0; i < n; i++) {
				alist.Add(int.Parse(input[i]));
			}

			double aAvg = alist.Average();
			int resultIndex = 0;
			double minAbs = Math.Abs(aAvg - alist[0]);
			for (int i = 0; i < n; i++)
			{
				double abs = Math.Abs(aAvg - alist[i]);
				if (abs == 0)
				{
					resultIndex = i;
					break;
				}else if (minAbs > abs)
				{
					resultIndex = i;
				}
			}
			
			Console.WriteLine(resultIndex);
		}
	}
}
