A,B,C,D=map(int,input().split()) ANS=2 if A==C: ANS-=1 if B==D: ANS-=1 if abs(A-C)+abs(B-D)<=3: ANS=min(ANS,1) print(ANS)