#include <iostream>
using namespace std;

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