X,Y = map(int,input().split()) if X == Y == 0: print (0) elif X * Y == 0: print (1) elif abs(X) == abs(Y): print (1) else: print (2)