#include <cstdio>
#include <iostream>

using namespace std;
int main()
{
    int x1,y1,x2,y2,suma;
    scanf("%d%d %d%", &x1, &y1, &x2, &y2);
    if ((x1==x2) || (y1==y2)) suma=2;
    else if ((x1==y1) && (x2==y2)) suma=1;
    else{
        suma=0;
    }
    cout<<suma;
    return 0;
}