
import java.util.*;
class Main { 
	public static void main (String...args) {
		int count = 0;
		Scanner scan = new Scanner(System.in);
		String w = scan.next();
		List<String>tList = new ArrayList<>();
		while(scan.hasNext()){
             String str = scan.next().toLowerCase();
			 tList.add(str);
		}
		for(int i = 0; i < tList.size(); i++) {
			if(w.equals(tList.get(i))) {
				count++;
			}
		}
		System.out.println(count);
	}
}
	 import java.util.*; util.* java class Main { 
	public static void main (String...args) {
		int count = 0;
		Scanner scan = new Scanner(System.in);
		String w = scan.next();
		List<String>tList = new ArrayList<>();
		while(scan.hasNext()){
             String str = scan.next().toLowerCase();
			 tList.add(str);
		}
		for(int i = 0; i < tList.size(); i++) {
			if(w.equals(tList.get(i))) {
				count++;
			}
		}
		System.out.println(count);
	}
} Main public static void main (String...args) {
		int count = 0;
		Scanner scan = new Scanner(System.in);
		String w = scan.next();
		List<String>tList = new ArrayList<>();
		while(scan.hasNext()){
             String str = scan.next().toLowerCase();
			 tList.add(str);
		}
		for(int i = 0; i < tList.size(); i++) {
			if(w.equals(tList.get(i))) {
				count++;
			}
		}
		System.out.println(count);
	} main {
		int count = 0;
		Scanner scan = new Scanner(System.in);
		String w = scan.next();
		List<String>tList = new ArrayList<>();
		while(scan.hasNext()){
             String str = scan.next().toLowerCase();
			 tList.add(str);
		}
		for(int i = 0; i < tList.size(); i++) {
			if(w.equals(tList.get(i))) {
				count++;
			}
		}
		System.out.println(count);
	} int count = 0; count 0 Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String w = scan.next(); w scan.next() scan.next scan List<String>tList = new ArrayList<>(); tList new ArrayList<>() while(scan.hasNext()){
             String str = scan.next().toLowerCase();
			 tList.add(str);
		} scan.hasNext() scan.hasNext scan {
             String str = scan.next().toLowerCase();
			 tList.add(str);
		} String str = scan.next().toLowerCase(); str scan.next().toLowerCase() scan.next().toLowerCase scan.next() scan.next scan tList.add(str) tList.add tList str for(int i = 0; i < tList.size(); i++) {
			if(w.equals(tList.get(i))) {
				count++;
			}
		} int i = 0; int i = 0; i 0 i < tList.size() i tList.size() tList.size tList i++ i++ i {
			if(w.equals(tList.get(i))) {
				count++;
			}
		} {
			if(w.equals(tList.get(i))) {
				count++;
			}
		} if(w.equals(tList.get(i))) {
				count++;
			} w.equals(tList.get(i)) w.equals w tList.get(i) tList.get tList i {
				count++;
			} count++ count System.out.println(count) System.out.println System.out System System.out count String...args args

import java.util.*;
class Main { 
	public static void main (String...args) {
		int count = 0;
		Scanner scan = new Scanner(System.in);
		String w = scan.next();
		List<String>tList = new ArrayList<>();
		while(scan.hasNext()){
             String str = scan.next().toLowerCase();
			 tList.add(str);
		}
		for(int i = 0; i < tList.size(); i++) {
			if(w.equals(tList.get(i))) {
				count++;
			}
		}
		System.out.println(count);
	}
}
	
