using System;
					
public class Program
{
	public static void Main()
	{
		int n = Convert.ToInt32(Console.ReadLine());
            int[] x = new int[n];
            int[] y = new int[n];
            string[] ulaz = new string[2];
            Random r = new Random();
            for (int i = 0; i < n; i++)
            {
                ulaz = Console.ReadLine().Split( );
                x[i] = Convert.ToInt32(ulaz[0]);
                y[i] = Convert.ToInt32(ulaz[1]);
            }
            if (n == 2)
            {
                if (x[0] != x[1] & y[0] != y[1])
                {
                    Console.WriteLine("0");
                }
                else
                {
                    Console.WriteLine("1");
                }

            }
            else
            {
                Console.WriteLine("0");
            }
		
	}
}