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