gx,gy = map(int, input().split()) if gx == 0 and gy == 0: print(0) exit(0) if gx == 0 or gy == 0 or abs(gx) == abs(gy): print(1) exit(0) print(2)