#include <cstdio>
#include <cstring>
using namespace std;

int hashtable[101];
int main() {
    int n,target;
    while (scanf("%d",&n)!=EOF) 
    { // 注意 while 处理多个 case
        if(n==0) break;
        memset(hashtable,0,101);
        while(0<n--)
        {
            scanf("%d",&target);
            ++hashtable[target];
        }
        scanf("%d",&target);
        printf("%d\n",hashtable[target]);
    }
}
// 64 位输出请用 printf("%lld")