x,y=map(int,input().split()) if x==y==0: print(0) exit() if abs(x)==abs(y): print(1) exit() if x==0 or y==0: print(1) exit() print(2)