#include <bits/stdc++.h>

using namespace std;

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