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

namespace ConsoleApp2
{
    class Program
    {
        
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string st = Console.ReadLine();
            string[] st2 = st.Split();
            int h = 0;
            List<int> nd = new List<int>();
            for (int i = 0; i < st.Length; i++)
            {
                nd[i] = int.Parse(st2[i]);
            }
            nd.Sort();
            List<int> jug = new List<int>();
            List<int> sever = new List<int>();
            List<int> potezi = new List<int>();
            for (int i = 0; i < nd.Count(); i++)
            {
                if (nd[i] < h)
                    jug.Add(nd[i]);
                else
                    sever.Add(nd[i]);
            }
            bool severmoze = true;
            bool jugmoze = true;
            if (Math.Abs(h - jug.Last<int>()) == 1 && jugmoze)
            {
                int zadnji = jug.Last<int>();
                jug.Remove(zadnji);
                jugmoze = false;
                severmoze = true;
                potezi.Add(2);
            }
            else if (Math.Abs(h - sever.First<int>()) == 1 && severmoze)
            {
                int zadnji = sever.First<int>();
                sever.Remove(zadnji);
                severmoze = false;
                jugmoze = true;
                potezi.Add(1);
            }
            if (jug.Last<int>() == h || sever.Last<int>() == h)
            {
                for(int i = 0; i<potezi.Count(); i++)
                {
                    Console.Write(potezi[i]);
                }
            }

        }
    }
}