以下提供不用陣列的python解,若有更好的可以底下再回復
time=int(input())+1
one=0
two=0
three=0
i=1
while i<time:
a=int(input())
b=a%3
if (b==1):
one+=1
elif (b==2):
two+=1
else:
three+=1
i+=1
print(str(three)+" "+str(one)+" "+str(two))