Replace Stack with counter, as the element is irrelevant.