consider the plus-minus sign of n, not x
bug free
only add 1 once