Solving a problem with instance of size $n$ in $O(n)$
You are not doing anything wrong. Typically, you would want to consider the running time with respect to some variable defined in the question. In this case, you could either consider it to be linear in $n$, or to be exponential in the number of bits in the input.
When talking about formal algorithms in the context of turing machines, the running time is defined with respect to the size of the input (which in this case would result in an exponential algorithm).
In other contexts, the running time is usually calculated with respect to one of the following things:

Number of elements in the input list, if the problem's input is a list
The values given in the input (for example, $n$ in this case)
The size of the input in bits