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

int main() {
    int n;
    while (cin >> n) {
        if (n == 0)    break;
        vector<int> a(n);
        for (int i = 0; i < n; i++) {
            cin >> a[i];
        }
        int target;
        cin >> target;
        int count = 0;
        for (int i = 0; i < n; i++) {
            if (a[i] == target)    count++;
        }
        cout << count << endl;
    }
}
// 64 位输出请用 printf("%lld")