#include <iostream>
#include <map>
using namespace std;
const int N = 1010;
int n;
map<int, int> score;
int main() {

    while (cin >> n) {
        if(n==0) break;
        score.clear();
        for (int i = 0; i < n; i++) {
            int x;
            cin >> x;
            score[x]++;
        }
        int grade;
        cin >>grade;
        cout << score[grade] << endl;
    }




}
// 64 位输出请用 printf("%lld")