import java.util.*;

public class Main {
    private static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
        String w = sc.next().toLowerCase();
        int cnt = 0;
        while (sc.hasNext()) {
            if (w.equals(sc.next().toLowerCase())) cnt++;
        }
        System.out.println(cnt);
    }
}
 import java.util.*; util.* java public class Main {
    private static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
        String w = sc.next().toLowerCase();
        int cnt = 0;
        while (sc.hasNext()) {
            if (w.equals(sc.next().toLowerCase())) cnt++;
        }
        System.out.println(cnt);
    }
} Main private static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args) throws Exception {
        String w = sc.next().toLowerCase();
        int cnt = 0;
        while (sc.hasNext()) {
            if (w.equals(sc.next().toLowerCase())) cnt++;
        }
        System.out.println(cnt);
    } main {
        String w = sc.next().toLowerCase();
        int cnt = 0;
        while (sc.hasNext()) {
            if (w.equals(sc.next().toLowerCase())) cnt++;
        }
        System.out.println(cnt);
    } 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()) {
            if (w.equals(sc.next().toLowerCase())) cnt++;
        } sc.hasNext() sc.hasNext sc {
            if (w.equals(sc.next().toLowerCase())) cnt++;
        } if (w.equals(sc.next().toLowerCase())) cnt++; w.equals(sc.next().toLowerCase()) w.equals w sc.next().toLowerCase() sc.next().toLowerCase sc.next() sc.next sc cnt++ cnt System.out.println(cnt) System.out.println System.out System System.out cnt String[] args args public class Main {
    private static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
        String w = sc.next().toLowerCase();
        int cnt = 0;
        while (sc.hasNext()) {
            if (w.equals(sc.next().toLowerCase())) cnt++;
        }
        System.out.println(cnt);
    }
} public class Main {
    private static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
        String w = sc.next().toLowerCase();
        int cnt = 0;
        while (sc.hasNext()) {
            if (w.equals(sc.next().toLowerCase())) cnt++;
        }
        System.out.println(cnt);
    }
} Main
import java.util.*;

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

