#include <stdio.h>
#include <stdlib.h>

int main()
{
    long long x[2], y[2];
    int n;
    scanf("%lld", &x[0]);
    scanf("%lld", &y[0]);
    scanf("%lld", &x[1]);
    scanf("%lld", &y[1]);

    if(x[0] == x[1] || y[0] == y[1])
        n = 2;
    else if(x[0] - x[1] == y[0] - y[1])
        n = 1;
    else
        n = 0;
    printf("%d", n);
    return 0;
}