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