#include <bits/stdc++.h>

using namespace std;

int main()
{
    int a, b, c, d;
    cin>>a>>b>>c>>d;
    if((a==c) || (b==d)) cout<<2;
    else if(abs(a-b)== abs(c-d)) cout<<1;
    else cout<<0;
    return 0;
}