Python count occurrences in array