Why does bash thinks that 010 is 8?

Solution 1:

Number sequences starting with a 0 are interpreted as octal numbers.
Octal 10 = decimal 8.

To get bash to treat it as a decimal number, remove the leading zero or force decimal with:

N=010
N=$((10#$N))

Generally that works for all bases, just replace the 10 with the base that you want:

N=[base#]n