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

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        ArrayList<String> array = new ArrayList<String>();
        String w = sc.next();
        while (sc.hasNext()) {
            array.add(sc.next());
        }
        sc.close();
        int count =0; 
        for (String string : array) {
            if(string.equalsIgnoreCase(w)){
                count++;
            }
        }
        System.out.println(count);
    }

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

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        ArrayList<String> array = new ArrayList<String>();
        String w = sc.next();
        while (sc.hasNext()) {
            array.add(sc.next());
        }
        sc.close();
        int count =0; 
        for (String string : array) {
            if(string.equalsIgnoreCase(w)){
                count++;
            }
        }
        System.out.println(count);
    }

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

        Scanner sc = new Scanner(System.in);
        ArrayList<String> array = new ArrayList<String>();
        String w = sc.next();
        while (sc.hasNext()) {
            array.add(sc.next());
        }
        sc.close();
        int count =0; 
        for (String string : array) {
            if(string.equalsIgnoreCase(w)){
                count++;
            }
        }
        System.out.println(count);
    } main {

        Scanner sc = new Scanner(System.in);
        ArrayList<String> array = new ArrayList<String>();
        String w = sc.next();
        while (sc.hasNext()) {
            array.add(sc.next());
        }
        sc.close();
        int count =0; 
        for (String string : array) {
            if(string.equalsIgnoreCase(w)){
                count++;
            }
        }
        System.out.println(count);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) ArrayList<String> array = new ArrayList<String>(); array new ArrayList<String>() String w = sc.next(); w sc.next() sc.next sc while (sc.hasNext()) {
            array.add(sc.next());
        } sc.hasNext() sc.hasNext sc {
            array.add(sc.next());
        } array.add(sc.next()) array.add array sc.next() sc.next sc sc.close() sc.close sc int count =0; count 0 for (String string : array) {
            if(string.equalsIgnoreCase(w)){
                count++;
            }
        } String string array {
            if(string.equalsIgnoreCase(w)){
                count++;
            }
        } {
            if(string.equalsIgnoreCase(w)){
                count++;
            }
        } if(string.equalsIgnoreCase(w)){
                count++;
            } string.equalsIgnoreCase(w) string.equalsIgnoreCase string w {
                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);
        ArrayList<String> array = new ArrayList<String>();
        String w = sc.next();
        while (sc.hasNext()) {
            array.add(sc.next());
        }
        sc.close();
        int count =0; 
        for (String string : array) {
            if(string.equalsIgnoreCase(w)){
                count++;
            }
        }
        System.out.println(count);
    }

} public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        ArrayList<String> array = new ArrayList<String>();
        String w = sc.next();
        while (sc.hasNext()) {
            array.add(sc.next());
        }
        sc.close();
        int count =0; 
        for (String string : array) {
            if(string.equalsIgnoreCase(w)){
                count++;
            }
        }
        System.out.println(count);
    }

} Main
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        ArrayList<String> array = new ArrayList<String>();
        String w = sc.next();
        while (sc.hasNext()) {
            array.add(sc.next());
        }
        sc.close();
        int count =0; 
        for (String string : array) {
            if(string.equalsIgnoreCase(w)){
                count++;
            }
        }
        System.out.println(count);
    }

}