import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String W = sc.next().toLowerCase();
		int cnt = 0;
		
		while(sc.hasNext()){
			String T = sc.next().toLowerCase();
			if(T.equals(W)){
				cnt++;
			}
		}
		
		System.out.println(cnt);
	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String W = sc.next().toLowerCase();
		int cnt = 0;
		
		while(sc.hasNext()){
			String T = sc.next().toLowerCase();
			if(T.equals(W)){
				cnt++;
			}
		}
		
		System.out.println(cnt);
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String W = sc.next().toLowerCase();
		int cnt = 0;
		
		while(sc.hasNext()){
			String T = sc.next().toLowerCase();
			if(T.equals(W)){
				cnt++;
			}
		}
		
		System.out.println(cnt);
	} main {
		Scanner sc = new Scanner(System.in);
		String W = sc.next().toLowerCase();
		int cnt = 0;
		
		while(sc.hasNext()){
			String T = sc.next().toLowerCase();
			if(T.equals(W)){
				cnt++;
			}
		}
		
		System.out.println(cnt);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String W = sc.next().toLowerCase(); W sc.next().toLowerCase() sc.next().toLowerCase sc.next() sc.next sc int cnt = 0; cnt 0 while(sc.hasNext()){
			String T = sc.next().toLowerCase();
			if(T.equals(W)){
				cnt++;
			}
		} sc.hasNext() sc.hasNext sc {
			String T = sc.next().toLowerCase();
			if(T.equals(W)){
				cnt++;
			}
		} String T = sc.next().toLowerCase(); T sc.next().toLowerCase() sc.next().toLowerCase sc.next() sc.next sc if(T.equals(W)){
				cnt++;
			} T.equals(W) T.equals T W {
				cnt++;
			} cnt++ cnt System.out.println(cnt) System.out.println System.out System System.out cnt String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String W = sc.next().toLowerCase();
		int cnt = 0;
		
		while(sc.hasNext()){
			String T = sc.next().toLowerCase();
			if(T.equals(W)){
				cnt++;
			}
		}
		
		System.out.println(cnt);
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String W = sc.next().toLowerCase();
		int cnt = 0;
		
		while(sc.hasNext()){
			String T = sc.next().toLowerCase();
			if(T.equals(W)){
				cnt++;
			}
		}
		
		System.out.println(cnt);
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String W = sc.next().toLowerCase();
		int cnt = 0;
		
		while(sc.hasNext()){
			String T = sc.next().toLowerCase();
			if(T.equals(W)){
				cnt++;
			}
		}
		
		System.out.println(cnt);
	}

}