#include <iostream>

using namespace std;

int main()
{
    long long int x1, y1, x2, y2;
    int R=0;
    cin>> x1;
    cin>> y1;
    cin>> x2;
    cin>> y2;
    if(x1==x2)
    {
        R=2;
    }
    else if (y1==y2)
    {
        R=2;
    }
    else if (x1-x2 == y1-y2)
    {
       R=1;
    }
    else if (x2-x1 == y2-y1)
    {
       R=1;
    }
    cout<<R;
    return 0;
}