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

namespace AizuOnLine_Lesson
{
    class Program
    {
        static void Main(string[] args)
        {
            List<int> data = Program.GetData();

            int result = 0;
            foreach (int num in data)
            {
                double sqrtNum = Math.Sqrt((double)num);

                bool flag = true;
                for (int i = 2; i < sqrtNum; i++)
                {
                    if (num % i == 0)
                    {
                        flag = false;
                        break;
                    }
                }

                result = flag ? 1 : 0;
            }

            Console.WriteLine(result);
        }

        private static List<int> GetData()
        {
            List<int> data = new List<int>();

            int count = Convert.ToInt32(Console.ReadLine());
            
            for (int i = 0; i < count; i++)
            {
                data.Add(Convert.ToInt32(Console.ReadLine()));
            }

            return data;
        }
    }
}