#include <bits/stdc++.h>

using namespace std;

int main () {
    int a, b, c, d;
   
    cin >> a >> c >> b >> d;
   
    if (a==b or c==d) cout << 2 << endl;
   
    else if (abs(a-b)==abs(c-d)) cout << 1 << endl;
   
    else cout << 0 << endl;
   

    return 0;
}