#include <bits/stdc++.h>
using namespace std;
long long x1,x2,Y1,Y2;
int main() {
    cin >> x1 >> Y1 >> x2 >> Y2;
    if( x1>x2 ) {swap(x1,x2);swap(Y1,Y2);}
    if( x1==x2 ) cout << 2 <<endl;
    else if( Y1==Y2 ) cout << 2 <<endl;
    else if( abs(x2-x1)==abs(Y2-Y1) ) cout << 1 <<endl;
    else cout << 0 <<endl;
return 0;
}