#include <iostream>
#include <cmath>
using namespace std;
int main(int argc, const char * argv[]) {
    long long int ax,ay,bx,by;
    cin>>ax>>ay>>bx>>by;
    
    if (abs(bx-ax)==abs(by-ay))
    {
        cout<<1<<endl;
    }
    else if (ax==bx||ay==by)
    {
        cout<<2<<endl;
    }
    else
    {
        cout<<0<<endl;
    }
    
    
    return 0;
}