A,B,C,D = list(map(int,input().split())) if A == C or B == D: print(1) elif abs(A-C) + abs(B-D) <= 3: print(1) else: print(2)