//土尔逊Torson 编写于2023/06/14
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <string>
#include <map>

using namespace std;

int main() {
	int n;
	while (scanf("%d", &n) != EOF) {
		if (0 == n) {
			break;
		}
		map<int, int> score;
		for (int i = 0; i < n; ++i) {
			int num;
			scanf("%d", &num);
			score[num]++;
		}
		int key;
		scanf("%d", &key);
		printf("%d\n", score[key]);
	}
	system("pause");
	return EXIT_SUCCESS;
}
// 64 位输出请用 printf("%lld")