#include <bits/stdc++.h>
using namespace std;
long long x1,x2,t1,t2;
long long br;
int main()
{
    cin >>x1>>t1>>x2>>t2;

    if(x1==x2 or t1==t2){
        br=2;
        }
    else if(x1!=x2 and t1!=t2){
        br=1;
        }
        cout << br << endl;

return 0;
}