def count(s, t):
    c=0
    for i in s:
        if i == t:
            c+=1
    print(c)
while True:
    try:
        n = int(input())
        if n ==0:
            break
        s = list(map(int, input().split()))
        t = int(input())
        count(s, t)
    except:
        break