#include #include int main() { int A, B, C, D, ans = 2; scanf("%d %d %d %d", &A, &B, &C, &D); if (abs(A - C) + abs(B - D) <= 3) ans = 1; else if (A == C || B == D) ans = 1; printf("%d\n", ans); fflush(stdout); return 0; }