Running time of an algorithm containing binary elements for cryptography
We take only one step for computing each $2^ix_i$ (By using left-shift operation we can compute $2^i$ in constant time). So the complexity of Algorithm $\mathcal{A}$ is $\mathcal{O}(n)$.

I suspect you used loop for computing $2^i$, and this incurred your bad result. 

PS : sorry for my bad english