Algorithms – What is the great complexity of time $ O $ of this nested loop for

I want the complexity of time to be great, oh $ Or $ as well as the value of the count in terms of $ n $

pseudocode

From my understanding,
the first for the cycle runs for $ lg (n) $ times where $ lg (x) = log_2 (x) $
Also, every time, $ i $ it's the way $ 2 ^ k $ where $ ; k en N cup {0 } $ Y $ j $ run from $ 1 $ to $ i-1 = 2 ^ k -1 ; forall k en N cup {0 }, $ such that $ 2 ^ k <n $

Thus,
$$ account = sum_ {k = 0} ^ {t} (2 ^ k – 1) $$ where $ 2 ^ t geq n rightarrow t geq lg (n) $. For the closest approximation to the count, take $ t = lg (n) ; text {{does this make sense?}} $ Then we get:

$$ count = sum_ {k = 0} ^ { lg (n)} (2 ^ {k} -1) = frac {1 times (2 ^ { lg (n)} – 1)} { 2-1} – ( lg (n) +1) = n- lg (n) -2 $$. So is this $ O (n) $?