[python] Counting array elements in Python