a,b = input().split() a = int(a) b = int(b) if a == 0 and b == 0: print(0) elif a**2 == b**2 or a*b == 0: print(1) else: print(2)