#include <stdio.h>

int main() {
    int n;
    int q;
    while (scanf("%d", &n) != EOF) {
        if (n != 0) {
            int a[n];
            for (int i = 0; i < n; i++) {
                scanf("%d", &a[i]);
            }

            scanf("%d", &q);
            int sum = 0;
            for (int i = 0; i < n; i++) {
                if (q == a[i])
                    sum++;
            }
            printf("%d\n", sum);
        }
        else {
        break;
        }
    }

    return 0;
}