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