a, b, c, d = map(lambda s_: int(s_), input().split()) x = abs(a - c) y = abs(b - d) ans = 1 if x == 0 or y == 0 or x + y <= 3 else 2 print(ans)