A, B, C, D = map(int, input().split()) C -= A D -= B C = abs(C) D = abs(D) print(1 if C == 0 or D == 0 or C + D <= 3 else 2)