#include<bits/stdc++.h>
using namespace std;
int main x1,x2,x3,x4;
int main(){
    cin>>x1>>x2>>x3>>x4;
    if(x1==x3 and x2==x4)cout<<"4";
    else if(x1==x3 or x2==x4)cout<<"2";
    else if(max(x1,x3)-min(x1,x3)==max(x2,x4)-min(x2,x4)cout<<"1";
    else cout<<"0";
    return 0;
}