Python Array Count Elements In A Stack