#include<bits/stdc++.h>
using namespace std;

long long absll(long long a){
    if(a<0)return -a;
    else return a;
}

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    long long x1,y1,x2,y2,dx,dy;
    cin>>x1>>y1>>x2>>y2;

    if(x1==x2 || y1==y2){
        cout << "2\n";
        return 0;
    }

    dx = x1-x2;
    dy = y1-y2;
    if(absll(dx)==absll(dy)){
        cout << "1\n";
    }
    else{
        cout << "0\n";
    }
}