#include <iostream>
#include <map>
using namespace std;

int main() {
    int n;
    while(cin >> n && n != 0){
        map<int, int> scores;
        while(n --){
            int x;
            cin >> x;
            scores[x] ++;
        }
        int score;
        cin >> score;
        cout << scores[score] << endl;
    }

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