import java.util.*;
import java.text.*;

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

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