A, B, C, D = map(int, input().split()) X = abs(A-C) Y = abs(B-D) if X==0 or Y==0: print(1) exit() if X<=1 and Y<=2: print(1) exit() if X<=2 and Y<=1: print(1) exit() print(2)