#include <stdio.h>
#include <math.h>

int brojKvadrata(x1, y1, x2, y2) {
//    if (x1 == x2 && y1 == y2) {
//        return 0;
//    }

    if (x1 == x2 || y1 == y2) {
        return 2;
    }

    return (fabs(x1 - x2) == fabs(y1 - y2) ? 1 : 0);
}

int main() {
    int x1, x2, y1, y2;
    scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
    printf("%d", brojKvadrata(x1, y1, x2, y2));
    return 0;
}