#include <iostream>

int main()
{
        int x1,x2,y1,y2;
        std::cin >> x1 >> y1;
        std::cin >> x2 >> y2;

        if(x1 != x2 && y2 != y1)
        {
                int razx,razy;
                razx = y1-x1;
                if(x1>y1)
                        razx = x1-y1;
                razy = y2-x2;
                if(x2>y2)
                        razy = x2-y2;

                if(razx==razy)
                        std::cout << "1";
                else
                        std::cout << "0";
                return 0;
        }
        else
                if(x1==x2 || y2==y1)
                {
                        std::cout << "2";
                        return 0;
                }


        return 0;
}