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