#include <iostream> #include <string> #include <vector> #include <algorithm> #include <stack> #include <map> #include <queue> #include <cmath> using namespace std; int main() { int n; map<int, int> score; while (scanf("%d", &n) != EOF) { if (0 == n) { break; } for (int i = 0; i < n; i++) { int t; scanf("%d", &t); if (score.find(t) != score.end()) { //有这个成绩 score[t]++; } else { score[t] = 1; } } int t; scanf("%d", &t); if (score.find(t) != score.end()) { //有这个成绩 printf("%d\n", score[t]); } else { printf("0\n"); } } }