using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.SymbolStore;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Net.WebSockets;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Schema;


namespace ConsoleApplication2
{

    class Program
    {

        static void Main(string[] args)
        {
            var s1 = Console.ReadLine().Split();
            int x1 = int.Parse(s1[0]);
            int y1 = int.Parse(s1[1]);
            var s2 = Console.ReadLine().Split();
            int x2 = int.Parse(s2[0]);
            int y2 = int.Parse(s2[1]);
            if(x1!=x2 && y1!=y2)
            {
                Console.WriteLine("1");
            }
            else if(x1==x2 || y1==y2)
            {
                Console.WriteLine("2");
            }

        }

    }
}