#include <bits/stdc++.h>

using namespace std;

int a, b;
int c, d;

int main () {
    
    cin >> a >> b >> c >> d;
    
    if (a != c and d == b) {
        cout << "2" << endl;
    }
    
    if (a == c and d != b) {
        cout << "2" << endl;
    }
    
    if (a != c and d != b and d - b == c - a) {
        cout << "1" << endl;
        
    }
    
    else if (a != c and d != b and d - b != c - a) {
        cout << "0" << endl;
        
    }
        
   
    
    return 0;
}