x=int(input())y=0while x!=0: if x%3==0: y+=1 x=int(input())print(y)
6 5 3 0
2
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!