#include <bits/stdc++.h>

using namespace std;

int main(){
    int x1, y1, x2, y2, brK;
    cin >> x1 >> y1;
    cin >> x2 >> y2;
    if(x1 == x2 || y1 == y2){
        brK = 2;
    }
    else{
        brK = 1;
    }
    cout << brK << endl;
    return 0;
}