Assume we have a stack with n numbers and if 3 or more adjacent numbers are equal then these numbers can be removed (the numbers are removed from top to bottom). Since this is a stack we have the normal push(), pop(), top() operations and we know n. Moreover I have an empty stack and O(1) extra memory space. Is there a linear algorithm for finding the quantity of the remaining number? If yes, what would that be?