#include <bits/stdc++.h>
using namespace std;
int x1,x2,n1,n2;
int d1,d2;
int main() {
cin >> x1 >> n1;
cin >> x2 >> n2;

if(x1==x2 or n1==n2){
    cout << 2 << endl;
}
else{
    if(x1>x2) swap(x1,x2);
    if(n1>n2) swap(n1,n2);
    d1=abs(x2-x1);
    d2=abs(n2-n1);
    if(d1==d2) cout << 1 << endl;
    else cout << 0 << endl;
}


return 0;
}