Python Count Elements In Array With Conditions