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