using System;

namespace ConsoleApp4
{
    class Program
    {
        static void Main(string[] args)
        {
            String[] s = Console.ReadLine().Split();
            int x1 = Convert.ToInt32(s[0]);
            int y1 = Convert.ToInt32(s[1]);
            String[] s1= Console.ReadLine().Split();
            int x2 = Convert.ToInt32(s[0]);
            int y2 = Convert.ToInt32(s[1]);

            if (x1==y1 && x2==y2)
            {
                Console.WriteLine("1");
            }
            else if (y1==y2 && x1!=x2)
            {
                Console.WriteLine("2");
            }
            else if (x1 == x2 && y1!=y2)
            {
                Console.WriteLine("2");
            }
            else
            {
                Console.WriteLine("0");
            }
        }
    }
}