import java.util.Scanner;
import java.util.*;
import java.io.*;

public class Main{
	public static void main(String [] args){
		BufferedReader r = new BufferedReader(new InputStreamReader(System.in),1200);
		String w = "";
		String work = "";
		String input = "";
		int count = 0;
		try{
			w = r.readLine();
			input = r.readLine();
			while(input != null){
				work += " ";
				work += input;
				input = r.readLine();
			}
		}catch(Exception e){
			System.out.println(e);
		}
		//System.out.println("w:"+w);
		//System.out.println("wcount:"+w.length());
		input = work;
		input = input.toLowerCase();
		//System.out.println(input);
		StringTokenizer st = new StringTokenizer(input," ");
		while(st.hasMoreTokens()){
			work = st.nextToken();
			if(work.length() < w.length()){
					continue;
			}else{
				/*for(int i = 0; i < work.length() - (w.length() - 1); i++){
					if(w.equals(work.substring(i,i + w.length()))){
						count++;
						break;
						//i = i + w.length() - 1;
					}
				}
				*/
				if(w.equals(work)){
					count++;
				}
			}
		}
		
		
		System.out.println(count);
	}
} import java.util.Scanner; Scanner java.util import java.util.*; util.* java import java.io.*; io.* java public class Main{
	public static void main(String [] args){
		BufferedReader r = new BufferedReader(new InputStreamReader(System.in),1200);
		String w = "";
		String work = "";
		String input = "";
		int count = 0;
		try{
			w = r.readLine();
			input = r.readLine();
			while(input != null){
				work += " ";
				work += input;
				input = r.readLine();
			}
		}catch(Exception e){
			System.out.println(e);
		}
		//System.out.println("w:"+w);
		//System.out.println("wcount:"+w.length());
		input = work;
		input = input.toLowerCase();
		//System.out.println(input);
		StringTokenizer st = new StringTokenizer(input," ");
		while(st.hasMoreTokens()){
			work = st.nextToken();
			if(work.length() < w.length()){
					continue;
			}else{
				/*for(int i = 0; i < work.length() - (w.length() - 1); i++){
					if(w.equals(work.substring(i,i + w.length()))){
						count++;
						break;
						//i = i + w.length() - 1;
					}
				}
				*/
				if(w.equals(work)){
					count++;
				}
			}
		}
		
		
		System.out.println(count);
	}
} Main public static void main(String [] args){
		BufferedReader r = new BufferedReader(new InputStreamReader(System.in),1200);
		String w = "";
		String work = "";
		String input = "";
		int count = 0;
		try{
			w = r.readLine();
			input = r.readLine();
			while(input != null){
				work += " ";
				work += input;
				input = r.readLine();
			}
		}catch(Exception e){
			System.out.println(e);
		}
		//System.out.println("w:"+w);
		//System.out.println("wcount:"+w.length());
		input = work;
		input = input.toLowerCase();
		//System.out.println(input);
		StringTokenizer st = new StringTokenizer(input," ");
		while(st.hasMoreTokens()){
			work = st.nextToken();
			if(work.length() < w.length()){
					continue;
			}else{
				/*for(int i = 0; i < work.length() - (w.length() - 1); i++){
					if(w.equals(work.substring(i,i + w.length()))){
						count++;
						break;
						//i = i + w.length() - 1;
					}
				}
				*/
				if(w.equals(work)){
					count++;
				}
			}
		}
		
		
		System.out.println(count);
	} main {
		BufferedReader r = new BufferedReader(new InputStreamReader(System.in),1200);
		String w = "";
		String work = "";
		String input = "";
		int count = 0;
		try{
			w = r.readLine();
			input = r.readLine();
			while(input != null){
				work += " ";
				work += input;
				input = r.readLine();
			}
		}catch(Exception e){
			System.out.println(e);
		}
		//System.out.println("w:"+w);
		//System.out.println("wcount:"+w.length());
		input = work;
		input = input.toLowerCase();
		//System.out.println(input);
		StringTokenizer st = new StringTokenizer(input," ");
		while(st.hasMoreTokens()){
			work = st.nextToken();
			if(work.length() < w.length()){
					continue;
			}else{
				/*for(int i = 0; i < work.length() - (w.length() - 1); i++){
					if(w.equals(work.substring(i,i + w.length()))){
						count++;
						break;
						//i = i + w.length() - 1;
					}
				}
				*/
				if(w.equals(work)){
					count++;
				}
			}
		}
		
		
		System.out.println(count);
	} BufferedReader r = new BufferedReader(new InputStreamReader(System.in),1200); r new BufferedReader(new InputStreamReader(System.in),1200) String w = ""; w "" String work = ""; work "" String input = ""; input "" int count = 0; count 0 try{
			w = r.readLine();
			input = r.readLine();
			while(input != null){
				work += " ";
				work += input;
				input = r.readLine();
			}
		}catch(Exception e){
			System.out.println(e);
		} catch(Exception e){
			System.out.println(e);
		} Exception e {
			System.out.println(e);
		} System.out.println(e) System.out.println System.out System System.out e {
			w = r.readLine();
			input = r.readLine();
			while(input != null){
				work += " ";
				work += input;
				input = r.readLine();
			}
		} w = r.readLine() w r.readLine() r.readLine r input = r.readLine() input r.readLine() r.readLine r while(input != null){
				work += " ";
				work += input;
				input = r.readLine();
			} input != null input null {
				work += " ";
				work += input;
				input = r.readLine();
			} work += " " work " " work += input work input input = r.readLine() input r.readLine() r.readLine r input = work input work input = input.toLowerCase() input input.toLowerCase() input.toLowerCase input StringTokenizer st = new StringTokenizer(input," "); st new StringTokenizer(input," ") while(st.hasMoreTokens()){
			work = st.nextToken();
			if(work.length() < w.length()){
					continue;
			}else{
				/*for(int i = 0; i < work.length() - (w.length() - 1); i++){
					if(w.equals(work.substring(i,i + w.length()))){
						count++;
						break;
						//i = i + w.length() - 1;
					}
				}
				*/
				if(w.equals(work)){
					count++;
				}
			}
		} st.hasMoreTokens() st.hasMoreTokens st {
			work = st.nextToken();
			if(work.length() < w.length()){
					continue;
			}else{
				/*for(int i = 0; i < work.length() - (w.length() - 1); i++){
					if(w.equals(work.substring(i,i + w.length()))){
						count++;
						break;
						//i = i + w.length() - 1;
					}
				}
				*/
				if(w.equals(work)){
					count++;
				}
			}
		} work = st.nextToken() work st.nextToken() st.nextToken st if(work.length() < w.length()){
					continue;
			}else{
				/*for(int i = 0; i < work.length() - (w.length() - 1); i++){
					if(w.equals(work.substring(i,i + w.length()))){
						count++;
						break;
						//i = i + w.length() - 1;
					}
				}
				*/
				if(w.equals(work)){
					count++;
				}
			} work.length() < w.length() work.length() work.length work w.length() w.length w {
					continue;
			} continue; {
				/*for(int i = 0; i < work.length() - (w.length() - 1); i++){
					if(w.equals(work.substring(i,i + w.length()))){
						count++;
						break;
						//i = i + w.length() - 1;
					}
				}
				*/
				if(w.equals(work)){
					count++;
				}
			} if(w.equals(work)){
					count++;
				} w.equals(work) w.equals w work {
					count++;
				} count++ count System.out.println(count) System.out.println System.out System System.out count String [] args args public class Main{
	public static void main(String [] args){
		BufferedReader r = new BufferedReader(new InputStreamReader(System.in),1200);
		String w = "";
		String work = "";
		String input = "";
		int count = 0;
		try{
			w = r.readLine();
			input = r.readLine();
			while(input != null){
				work += " ";
				work += input;
				input = r.readLine();
			}
		}catch(Exception e){
			System.out.println(e);
		}
		//System.out.println("w:"+w);
		//System.out.println("wcount:"+w.length());
		input = work;
		input = input.toLowerCase();
		//System.out.println(input);
		StringTokenizer st = new StringTokenizer(input," ");
		while(st.hasMoreTokens()){
			work = st.nextToken();
			if(work.length() < w.length()){
					continue;
			}else{
				/*for(int i = 0; i < work.length() - (w.length() - 1); i++){
					if(w.equals(work.substring(i,i + w.length()))){
						count++;
						break;
						//i = i + w.length() - 1;
					}
				}
				*/
				if(w.equals(work)){
					count++;
				}
			}
		}
		
		
		System.out.println(count);
	}
} public class Main{
	public static void main(String [] args){
		BufferedReader r = new BufferedReader(new InputStreamReader(System.in),1200);
		String w = "";
		String work = "";
		String input = "";
		int count = 0;
		try{
			w = r.readLine();
			input = r.readLine();
			while(input != null){
				work += " ";
				work += input;
				input = r.readLine();
			}
		}catch(Exception e){
			System.out.println(e);
		}
		//System.out.println("w:"+w);
		//System.out.println("wcount:"+w.length());
		input = work;
		input = input.toLowerCase();
		//System.out.println(input);
		StringTokenizer st = new StringTokenizer(input," ");
		while(st.hasMoreTokens()){
			work = st.nextToken();
			if(work.length() < w.length()){
					continue;
			}else{
				/*for(int i = 0; i < work.length() - (w.length() - 1); i++){
					if(w.equals(work.substring(i,i + w.length()))){
						count++;
						break;
						//i = i + w.length() - 1;
					}
				}
				*/
				if(w.equals(work)){
					count++;
				}
			}
		}
		
		
		System.out.println(count);
	}
} Main
import java.util.Scanner;
import java.util.*;
import java.io.*;

public class Main{
	public static void main(String [] args){
		BufferedReader r = new BufferedReader(new InputStreamReader(System.in),1200);
		String w = "";
		String work = "";
		String input = "";
		int count = 0;
		try{
			w = r.readLine();
			input = r.readLine();
			while(input != null){
				work += " ";
				work += input;
				input = r.readLine();
			}
		}catch(Exception e){
			System.out.println(e);
		}
		//System.out.println("w:"+w);
		//System.out.println("wcount:"+w.length());
		input = work;
		input = input.toLowerCase();
		//System.out.println(input);
		StringTokenizer st = new StringTokenizer(input," ");
		while(st.hasMoreTokens()){
			work = st.nextToken();
			if(work.length() < w.length()){
					continue;
			}else{
				/*for(int i = 0; i < work.length() - (w.length() - 1); i++){
					if(w.equals(work.substring(i,i + w.length()))){
						count++;
						break;
						//i = i + w.length() - 1;
					}
				}
				*/
				if(w.equals(work)){
					count++;
				}
			}
		}
		
		
		System.out.println(count);
	}
}