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