Python Count Number Of Occurrences In Array Function