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