M = 2024

x1, y1, x2, y2 = map(int, input().split())

corners = [(0, 0), (0, M), (M, 0), (M, M)]

ans = 2
for p in [(x1, y1), (x2, y2)]:
    if p in corners:
        ans -= 1

print(ans)
