stars = 0
while(1==1):
    x = int(input())
    if(x == 5):
        stars += 1
    if(x == 0):
        break
print(int(stars))

33c40d4f3674da60b63a43a270f72a1d91c53aa7
<mask token>

<mask token>
while 1 == 1:
    x = int(input())
    if x == 5:
        stars += 1
    if x == 0:
        break
print(int(stars))

stars = 0
while 1 == 1:
    x = int(input())
    if x == 5:
        stars += 1
    if x == 0:
        break
print(int(stars))

stars = 0
while(1==1):
    x = int(input())
    if(x == 5):
        stars += 1
    if(x == 0):
        break
print(int(stars))
