import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int[] mat = new int[1001];// 最多只有1000个,浪费1个
int temp = 0, count = 0;
while (sc.hasNext()) {
int n = sc.nextInt();
if (n == 0) {
return;
}
for (int i = 1; i <= n; i++) {
mat[i] = sc.nextInt();
}
temp = sc.nextInt();
count = 0;
for (int i = 1; i <= n; i++) {
if (temp == mat[i]) {
count++;
}
}
System.out.println(count);
}
}
}