#include <stdio.h>
#include <limits.h>
#include <string.h>
#include <ctype.h>
char *gets(char *str);
//char gets(char str);
char N[25];
char gohell[100000];
int A[25];
char x;
int main(void){
int n,t=0,o,c=0;
scanf("%s",N);
n=strlen(N);
//printf("n=%d\n",n);
while(x=getchar()!=EOF){
//if(x==' ' || x=='\n' || x=='-' || x=='/' || x==':' || x=='(' || x==')' || x=='[' || x==']' || x==',' || x=='.'){
c=0;
o=0;
for(int i=0;i<n;i++){
x=getchar();
if(x==N[i] || x==N[i]+32 || x==N[i]-32){
o++;
}
else{
c=1;
break;
}
}
x=getchar();
if(x==' ' || x=='\n' || x=='-' || x=='/' || x==':' || x=='(' || x==')' || x=='[' || x==']' || x==',' || x=='.'){
if (c==0 && o==n){
t++;
}
}
//}
}
printf("%d\n",t);
return 0;
}