#include <bits/stdc++.h>
typedef long long ll;

using namespace std;

struct tacka{
    ll x, y;
};

int resenje(tacka t1, tacka t2){
    if(abs(t1.x - t2.x) != abs(t1.y - t2.y)) return 0;
    else if(abs(t1.x - t2.x) == abs(t1.y - t2.y)) return 1;
    else if(abs(t1.x == t2.x) || abs(t1.y == t2.y)) return 2;
}

int main(){
    tacka t1, t2;
    cin >> t1.x >> t1.y >> t2.x >> t2.y;
    cout << resenje(t1, t2);
    return 0;
}