# Solving a problem with instance of size $n$ in $O(n)$

Today I read the following text in CLRS:

We say that an algorithm solves a concrete problem in time $$O(T(n))$$ if, when it is provided a problem instance $$i$$ of length $$n = |i|$$, the algorithm can produce the solution in $$O(T(n))$$ time

It is ambiguous for me, because if we consider a problem in which a number $$n$$ is given and we have to print $$1$$ for $$n$$ times, and our input is the number $$n$$ in binary format, our input has a size of $$O(lg(n))$$, and since we do an action $$n$$ times, the algorithm runs in $$O(n)$$, and since $$O(n) = O(2^{lg(n)})$$, the algorithm is exponential.

What am I doing wrong here?

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.
2. The values given in the input (for example, $$n$$ in this case)