# Arup Guha
# 11/16/2024
# Solution to 2024 D1/D2 SER Problem: Triangles of a Square

# Returns number of corners.
def corners(a):

    res = 0

    # Check if first pt is a corner.
    if (a[0] == 0 or a[0] == 2024) and (a[1] == 0 or a[1] == 2024):
        res += 1

    # And second pt.
    if (a[2] == 0 or a[2] == 2024) and (a[3] == 0 or a[3] == 2024):
        res += 1

    # Ta da!
    return res

# Get input.
vals = [int(x) for x in input().split()]

# Kinda cool, this works.
print(2 - corners(vals))

