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