a=100 b=-a while a:a-=int(input())%8%3-1;b+=1 print(1*b)