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