/**/
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cctype>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <string>
#include <stack>
#include <queue>

typedef long long LL;
using namespace std;

int n;
int a;

int main()
{
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);

	while(scanf("%d", &n) == 1){
		if(!n) break;
		map<int, int>mp;
		for (int i = 1; i <= n; i++){
			scanf("%d", &a);
			mp[a]++;
		}
		scanf("%d", &a);
		printf("%d\n", mp[a]);
	}

	return 0;
}
/**/