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

int main() {
    int n;
    while(cin>>n){
        if(n==0) break;
        map<int,int> score;
        vector<int> tem;
        for(int i=0;i<n;i++){
            int grade;
            cin>>grade;
            tem.push_back(grade);
            score[grade]=0;//initialize
        }
        for(int i=0;i<n;i++){
            int t=tem[i];
            score[t]++;
        }
        int targ;
        cin>>targ;
        cout<<score[targ]<<endl;

    }
}