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