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

int a,b,c,d;

int main(){
    cin >> a >> b >> c >> d;

    if(abs(a - c) == abs(b - d))
      cout << "1";

    else if(a == c || b == d)
      cout << "2";

    else cout << "0";

    return 0;
}