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