import java.util.Scanner;

public class Main{

	static final Scanner s=new Scanner(System.in);

	public static void main(String args[]){
		String a=s.next().toLowerCase(),b;
		int c=0;
		while(!(b=s.next()).equals("END_OF_TEXT"))
			if(a.equals(b.toLowerCase()))
				c++;
		System.out.println(c);
	}
} import java.util.Scanner; Scanner java.util public class Main{

	static final Scanner s=new Scanner(System.in);

	public static void main(String args[]){
		String a=s.next().toLowerCase(),b;
		int c=0;
		while(!(b=s.next()).equals("END_OF_TEXT"))
			if(a.equals(b.toLowerCase()))
				c++;
		System.out.println(c);
	}
} Main static final Scanner s=new Scanner(System.in); s new Scanner(System.in) public static void main(String args[]){
		String a=s.next().toLowerCase(),b;
		int c=0;
		while(!(b=s.next()).equals("END_OF_TEXT"))
			if(a.equals(b.toLowerCase()))
				c++;
		System.out.println(c);
	} main {
		String a=s.next().toLowerCase(),b;
		int c=0;
		while(!(b=s.next()).equals("END_OF_TEXT"))
			if(a.equals(b.toLowerCase()))
				c++;
		System.out.println(c);
	} String a=s.next().toLowerCase() a s.next().toLowerCase() s.next().toLowerCase s.next() s.next s b; b int c=0; c 0 while(!(b=s.next()).equals("END_OF_TEXT"))
			if(a.equals(b.toLowerCase()))
				c++; !(b=s.next()).equals("END_OF_TEXT") (b=s.next()).equals("END_OF_TEXT") (b=s.next()).equals (b=s.next()) b s.next() s.next s "END_OF_TEXT" if(a.equals(b.toLowerCase()))
				c++; a.equals(b.toLowerCase()) a.equals a b.toLowerCase() b.toLowerCase b c++ c System.out.println(c) System.out.println System.out System System.out c String args[] args public class Main{

	static final Scanner s=new Scanner(System.in);

	public static void main(String args[]){
		String a=s.next().toLowerCase(),b;
		int c=0;
		while(!(b=s.next()).equals("END_OF_TEXT"))
			if(a.equals(b.toLowerCase()))
				c++;
		System.out.println(c);
	}
} public class Main{

	static final Scanner s=new Scanner(System.in);

	public static void main(String args[]){
		String a=s.next().toLowerCase(),b;
		int c=0;
		while(!(b=s.next()).equals("END_OF_TEXT"))
			if(a.equals(b.toLowerCase()))
				c++;
		System.out.println(c);
	}
} Main
import java.util.Scanner;

public class Main{

	static final Scanner s=new Scanner(System.in);

	public static void main(String args[]){
		String a=s.next().toLowerCase(),b;
		int c=0;
		while(!(b=s.next()).equals("END_OF_TEXT"))
			if(a.equals(b.toLowerCase()))
				c++;
		System.out.println(c);
	}
}