using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace Atcoder
{
    class aaaa
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string[] rawAinput = Console.ReadLine().Split(' ');
            double[] Ainput = rawAinput.Select(double.Parse).ToArray();

            //aアベレージ出す
            double Aave = Ainput.Average();

            //forループ回して最も平均にちかい物を調べる
            int ansnum = 101;double diff2 = 0; int daburi = 1;
            for (int i = 0;i<N;i++){
                double diff = 0;
                diff = Math.Abs(Ainput[i] - Aave);
                
                if(ansnum > diff){//個々の処理が大切
                    //todoフレームが複数ある場合
                    ansnum = Convert.ToInt32(Ainput[i]);

                    diff2 = diff;//一回目のダブり判定用
                }else if (diff == diff2){
                    daburi++;
                }

            }

            if (N == daburi){
                Console.WriteLine(0);
            }
            else{
                Console.WriteLine(ansnum);
            }
        }
    }
}