xy = input() xy_spl = xy.split() x = int(xy_spl[0]) y = int(xy_spl[1]) if (x == 0 and y == 0): print(0) elif (x == 0 or y == 0): print(1) elif (x == y or x == -y): print(1) else: print(2)