#include <iostream>
using namespace std;

int calSame(int n,int* A,int key){
    int count = 0, i;
    for(i = 0;i < n; i++){
        if(A[i] == key) count++;
    }
    return count;
}

int main() {
    int n, i, key;
    while(cin >> n){
        if(n == 0) break;
        int* A = new int[n];
        for(i = 0;i < n; i++){
            cin >> A[i];
        }
        cin >> key;
        cout << calSame(n, A, key) << endl;
        delete []A;
    }

    return 0;
    
}