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

ll sq(ll x1, ll x2, ll y1, ll y2){
    if (abs(x1 - x2) == abs(y1 - y2)){
        return 1;}
    if (x1 == x2 || y1 == y2){
        return 2;}
    return 0;
}

int main()
{
    ll x1, x2, y1, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    cout << sq(x1, x2, y1, y2);
    return 0;
}