import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        Set<String> S = new HashSet<>();
        int n = sc.nextInt();
        for (int i=0; i<n; i++) {
            S.add(sc.next());
        }

        Set<String> T = new HashSet<>();
        int q = sc.nextInt();
        for (int i=0; i<q; i++) {
            T.add(sc.next());
        }

        S.retainAll(T);
        System.out.println(S.size());
    }
}
 import java.util.*; util.* java class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        Set<String> S = new HashSet<>();
        int n = sc.nextInt();
        for (int i=0; i<n; i++) {
            S.add(sc.next());
        }

        Set<String> T = new HashSet<>();
        int q = sc.nextInt();
        for (int i=0; i<q; i++) {
            T.add(sc.next());
        }

        S.retainAll(T);
        System.out.println(S.size());
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        Set<String> S = new HashSet<>();
        int n = sc.nextInt();
        for (int i=0; i<n; i++) {
            S.add(sc.next());
        }

        Set<String> T = new HashSet<>();
        int q = sc.nextInt();
        for (int i=0; i<q; i++) {
            T.add(sc.next());
        }

        S.retainAll(T);
        System.out.println(S.size());
    } main {
        Scanner sc = new Scanner(System.in);

        Set<String> S = new HashSet<>();
        int n = sc.nextInt();
        for (int i=0; i<n; i++) {
            S.add(sc.next());
        }

        Set<String> T = new HashSet<>();
        int q = sc.nextInt();
        for (int i=0; i<q; i++) {
            T.add(sc.next());
        }

        S.retainAll(T);
        System.out.println(S.size());
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) Set<String> S = new HashSet<>(); S new HashSet<>() int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc for (int i=0; i<n; i++) {
            S.add(sc.next());
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            S.add(sc.next());
        } {
            S.add(sc.next());
        } S.add(sc.next()) S.add S sc.next() sc.next sc Set<String> T = new HashSet<>(); T new HashSet<>() int q = sc.nextInt(); q sc.nextInt() sc.nextInt sc for (int i=0; i<q; i++) {
            T.add(sc.next());
        } int i=0; int i=0; i 0 i<q i q i++ i++ i {
            T.add(sc.next());
        } {
            T.add(sc.next());
        } T.add(sc.next()) T.add T sc.next() sc.next sc S.retainAll(T) S.retainAll S T System.out.println(S.size()) System.out.println System.out System System.out S.size() S.size S String[] args args
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        Set<String> S = new HashSet<>();
        int n = sc.nextInt();
        for (int i=0; i<n; i++) {
            S.add(sc.next());
        }

        Set<String> T = new HashSet<>();
        int q = sc.nextInt();
        for (int i=0; i<q; i++) {
            T.add(sc.next());
        }

        S.retainAll(T);
        System.out.println(S.size());
    }
}

