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