Time Complexity

What is the Time complexity of the problem “Stock Span Problem” sloved using stack.

It would be O(n), since every bar is added or removed from stack only once.