• 计数排序或者映射均可
#include<iostream>
#include<map>
using namespace std;

int main(){
  int n;
  while(scanf("%d",&n)!=EOF){
    if(n==0)break;
    map<int,int>mymap;
    while(n--){
      int score;
      scanf("%d",&score);
      mymap[score]++;
    }
    int x;
    scanf("%d",&x);
    printf("%d\n",mymap[x]);
  }

  return 0;
}