import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

class Main {

	public static void main(String[] args) {

		String word;
		int count = 0;
		List<String> text = new ArrayList<>();
		final String EOT = "END_OF_TEXT";

		Scanner stdIn = new Scanner(System.in);

		word = stdIn.nextLine();

		for(int i = 0;;i++) {
			String s = stdIn.next();
			if(s.equals(EOT)) {
				break;
			}
			text.add(s);
		}

		for(String s : text) {
//			System.out.println(s + " == " + word + " : " + s.compareToIgnoreCase(word));
			if(s.compareToIgnoreCase(word) == 0) {
				count++;
			}
		}

		System.out.println(count);


		stdIn.close();
	}

} import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util class Main {

	public static void main(String[] args) {

		String word;
		int count = 0;
		List<String> text = new ArrayList<>();
		final String EOT = "END_OF_TEXT";

		Scanner stdIn = new Scanner(System.in);

		word = stdIn.nextLine();

		for(int i = 0;;i++) {
			String s = stdIn.next();
			if(s.equals(EOT)) {
				break;
			}
			text.add(s);
		}

		for(String s : text) {
//			System.out.println(s + " == " + word + " : " + s.compareToIgnoreCase(word));
			if(s.compareToIgnoreCase(word) == 0) {
				count++;
			}
		}

		System.out.println(count);


		stdIn.close();
	}

} Main public static void main(String[] args) {

		String word;
		int count = 0;
		List<String> text = new ArrayList<>();
		final String EOT = "END_OF_TEXT";

		Scanner stdIn = new Scanner(System.in);

		word = stdIn.nextLine();

		for(int i = 0;;i++) {
			String s = stdIn.next();
			if(s.equals(EOT)) {
				break;
			}
			text.add(s);
		}

		for(String s : text) {
//			System.out.println(s + " == " + word + " : " + s.compareToIgnoreCase(word));
			if(s.compareToIgnoreCase(word) == 0) {
				count++;
			}
		}

		System.out.println(count);


		stdIn.close();
	} main {

		String word;
		int count = 0;
		List<String> text = new ArrayList<>();
		final String EOT = "END_OF_TEXT";

		Scanner stdIn = new Scanner(System.in);

		word = stdIn.nextLine();

		for(int i = 0;;i++) {
			String s = stdIn.next();
			if(s.equals(EOT)) {
				break;
			}
			text.add(s);
		}

		for(String s : text) {
//			System.out.println(s + " == " + word + " : " + s.compareToIgnoreCase(word));
			if(s.compareToIgnoreCase(word) == 0) {
				count++;
			}
		}

		System.out.println(count);


		stdIn.close();
	} String word; word int count = 0; count 0 List<String> text = new ArrayList<>(); text new ArrayList<>() final String EOT = "END_OF_TEXT"; EOT "END_OF_TEXT" Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) word = stdIn.nextLine() word stdIn.nextLine() stdIn.nextLine stdIn for(int i = 0;;i++) {
			String s = stdIn.next();
			if(s.equals(EOT)) {
				break;
			}
			text.add(s);
		} int i = 0; int i = 0; i 0 i++ i++ i {
			String s = stdIn.next();
			if(s.equals(EOT)) {
				break;
			}
			text.add(s);
		} {
			String s = stdIn.next();
			if(s.equals(EOT)) {
				break;
			}
			text.add(s);
		} String s = stdIn.next(); s stdIn.next() stdIn.next stdIn if(s.equals(EOT)) {
				break;
			} s.equals(EOT) s.equals s EOT {
				break;
			} break; text.add(s) text.add text s for(String s : text) {
//			System.out.println(s + " == " + word + " : " + s.compareToIgnoreCase(word));
			if(s.compareToIgnoreCase(word) == 0) {
				count++;
			}
		} String s text {
//			System.out.println(s + " == " + word + " : " + s.compareToIgnoreCase(word));
			if(s.compareToIgnoreCase(word) == 0) {
				count++;
			}
		} {
//			System.out.println(s + " == " + word + " : " + s.compareToIgnoreCase(word));
			if(s.compareToIgnoreCase(word) == 0) {
				count++;
			}
		} if(s.compareToIgnoreCase(word) == 0) {
				count++;
			} s.compareToIgnoreCase(word) == 0 s.compareToIgnoreCase(word) s.compareToIgnoreCase s word 0 {
				count++;
			} count++ count System.out.println(count) System.out.println System.out System System.out count stdIn.close() stdIn.close stdIn String[] args args
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

class Main {

	public static void main(String[] args) {

		String word;
		int count = 0;
		List<String> text = new ArrayList<>();
		final String EOT = "END_OF_TEXT";

		Scanner stdIn = new Scanner(System.in);

		word = stdIn.nextLine();

		for(int i = 0;;i++) {
			String s = stdIn.next();
			if(s.equals(EOT)) {
				break;
			}
			text.add(s);
		}

		for(String s : text) {
//			System.out.println(s + " == " + word + " : " + s.compareToIgnoreCase(word));
			if(s.compareToIgnoreCase(word) == 0) {
				count++;
			}
		}

		System.out.println(count);


		stdIn.close();
	}

}