#include <bits/stdc++.h>
using namespace std;
int x,x2,y,y2;
int main(){
cin>>x>>y>>x2>>y2;
if (x==x2)
    cout<<"2";
else if (y==y2)
    cout<<"2";
     else if (x==y and x2==y2)
        cout<<"1";
     else
        cout<<"0";
     return 0;
}