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

int main() {
    int n;
    while (cin >> n) { 
        if(n==0)break;
        map<int,int> mymap;
        for(int i=1;i<=n;i++)
        {
            int fs;cin>>fs;
            mymap[fs]++;
        }
        int cz;cin>>cz;
        cout<<mymap[cz]<<endl;
    }
}