a, b, c, d = map(int, input().split()) if abs(c-a) + abs(d-b) <= 3: print(1) elif a == c or b == d: print(1) else: print(2)