import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int count = 0;
		String line1 = sc.next().toUpperCase();
		while (sc.hasNext()) {
			String line2 = sc.next().toUpperCase();

			if(line2.equals(line1)) {
				count++;
			}

		}
		System.out.println(count);

	}

} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int count = 0;
		String line1 = sc.next().toUpperCase();
		while (sc.hasNext()) {
			String line2 = sc.next().toUpperCase();

			if(line2.equals(line1)) {
				count++;
			}

		}
		System.out.println(count);

	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int count = 0;
		String line1 = sc.next().toUpperCase();
		while (sc.hasNext()) {
			String line2 = sc.next().toUpperCase();

			if(line2.equals(line1)) {
				count++;
			}

		}
		System.out.println(count);

	} main {
		Scanner sc = new Scanner(System.in);
		int count = 0;
		String line1 = sc.next().toUpperCase();
		while (sc.hasNext()) {
			String line2 = sc.next().toUpperCase();

			if(line2.equals(line1)) {
				count++;
			}

		}
		System.out.println(count);

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int count = 0; count 0 String line1 = sc.next().toUpperCase(); line1 sc.next().toUpperCase() sc.next().toUpperCase sc.next() sc.next sc while (sc.hasNext()) {
			String line2 = sc.next().toUpperCase();

			if(line2.equals(line1)) {
				count++;
			}

		} sc.hasNext() sc.hasNext sc {
			String line2 = sc.next().toUpperCase();

			if(line2.equals(line1)) {
				count++;
			}

		} String line2 = sc.next().toUpperCase(); line2 sc.next().toUpperCase() sc.next().toUpperCase sc.next() sc.next sc if(line2.equals(line1)) {
				count++;
			} line2.equals(line1) line2.equals line2 line1 {
				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) {
		Scanner sc = new Scanner(System.in);
		int count = 0;
		String line1 = sc.next().toUpperCase();
		while (sc.hasNext()) {
			String line2 = sc.next().toUpperCase();

			if(line2.equals(line1)) {
				count++;
			}

		}
		System.out.println(count);

	}

} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int count = 0;
		String line1 = sc.next().toUpperCase();
		while (sc.hasNext()) {
			String line2 = sc.next().toUpperCase();

			if(line2.equals(line1)) {
				count++;
			}

		}
		System.out.println(count);

	}

} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int count = 0;
		String line1 = sc.next().toUpperCase();
		while (sc.hasNext()) {
			String line2 = sc.next().toUpperCase();

			if(line2.equals(line1)) {
				count++;
			}

		}
		System.out.println(count);

	}

}