#include <bits/stdc++.h>

using namespace std;

const int N = 110;

int cnt[N];

int main(){
	
	int n;
	while (cin >> n){
		if (n == 0) break;
		for (int i=0; i<n; i++){
			int grade;
			cin >> grade;
			cnt[grade] ++;
		}
		int query;
		cin >> query;
		
		printf("%d\n", cnt[query]);
	}
	
	return 0;
}