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