#include <cstdio>
#include <cmath>

using namespace std;

int main() {
    long long x1,y1,x2,y2,k1,k2;
    scanf("%lld%lld%lld%lld", &x1,&y1,&x2,&y2);
    if(x1 < 0 && x2 > 0) {
        k1 = abs(x1 + x2);
    }
    else if(x2 < 0 && x1 > 0) {
        k1 = abs(x2 + x1);
    }

    if(y1 < 0 && y2 > 0) {
        k2 = abs(y1 + y2);
    }
    else if(y2 < 0 && y1 > 0) {
        k2 = abs(y2 + y1);
    }
    else {
        k1 = x2 - x1;
        k2 = y2 - y1;
    }
    if(k1 == k2) {
        printf("1");
    }
    else if(x1 == x2 || y1 == y2) {
        printf("2");
    }
    else printf("0");
    return 0;

}