#include <stdio.h>
int main(){
    int N;
    while(scanf("%d", &N) != EOF){
        if(N == 0){
            break;
        }
        int grade[1001] = {0};
        for (int i = 0; i < N; ++i) {
            scanf("%d", &grade[i]);
        }
        int score = 0;
        int count = 0;
        scanf("%d", &score);
        //判断并输出
        for (int i = 0; i < N; ++i) {
            if (grade[i] == score){
                count++;
            }
        }
        printf("%d\n", count);
    }
    return 0;
}