import java.util.*;

public class Main {

    Scanner sc = new Scanner(System.in);

    void solve() {
        // Input
        int n = sc.nextInt();
        int[] S = new int[n];
        for (int i = 0; i < n; i++) {
            S[i] = sc.nextInt();
        }
        int q = sc.nextInt();
        int[] T = new int[q];
        for (int i = 0; i < q; i++) {
            T[i] = sc.nextInt();
        }
        // Solve
        Set<Integer> set = new HashSet<>();
        for (int s : S) {
            set.add(s);
        }
        int cnt = 0;
        for (int t : T) {
            if (set.contains(t)) {
                cnt++;
            }
        }
        // Output
        System.out.println(cnt);
    }

    public static void main(String[] args) {
        new Main().solve();
    }
}
 import java.util.*; util.* java public class Main {

    Scanner sc = new Scanner(System.in);

    void solve() {
        // Input
        int n = sc.nextInt();
        int[] S = new int[n];
        for (int i = 0; i < n; i++) {
            S[i] = sc.nextInt();
        }
        int q = sc.nextInt();
        int[] T = new int[q];
        for (int i = 0; i < q; i++) {
            T[i] = sc.nextInt();
        }
        // Solve
        Set<Integer> set = new HashSet<>();
        for (int s : S) {
            set.add(s);
        }
        int cnt = 0;
        for (int t : T) {
            if (set.contains(t)) {
                cnt++;
            }
        }
        // Output
        System.out.println(cnt);
    }

    public static void main(String[] args) {
        new Main().solve();
    }
} Main Scanner sc = new Scanner(System.in); sc new Scanner(System.in) void solve() {
        // Input
        int n = sc.nextInt();
        int[] S = new int[n];
        for (int i = 0; i < n; i++) {
            S[i] = sc.nextInt();
        }
        int q = sc.nextInt();
        int[] T = new int[q];
        for (int i = 0; i < q; i++) {
            T[i] = sc.nextInt();
        }
        // Solve
        Set<Integer> set = new HashSet<>();
        for (int s : S) {
            set.add(s);
        }
        int cnt = 0;
        for (int t : T) {
            if (set.contains(t)) {
                cnt++;
            }
        }
        // Output
        System.out.println(cnt);
    } solve {
        // Input
        int n = sc.nextInt();
        int[] S = new int[n];
        for (int i = 0; i < n; i++) {
            S[i] = sc.nextInt();
        }
        int q = sc.nextInt();
        int[] T = new int[q];
        for (int i = 0; i < q; i++) {
            T[i] = sc.nextInt();
        }
        // Solve
        Set<Integer> set = new HashSet<>();
        for (int s : S) {
            set.add(s);
        }
        int cnt = 0;
        for (int t : T) {
            if (set.contains(t)) {
                cnt++;
            }
        }
        // Output
        System.out.println(cnt);
    } int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] S = new int[n]; S new int[n] n for (int i = 0; i < n; i++) {
            S[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            S[i] = sc.nextInt();
        } {
            S[i] = sc.nextInt();
        } S[i] = sc.nextInt() S[i] S i sc.nextInt() sc.nextInt sc int q = sc.nextInt(); q sc.nextInt() sc.nextInt sc int[] T = new int[q]; T new int[q] q for (int i = 0; i < q; i++) {
            T[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
            T[i] = sc.nextInt();
        } {
            T[i] = sc.nextInt();
        } T[i] = sc.nextInt() T[i] T i sc.nextInt() sc.nextInt sc Set<Integer> set = new HashSet<>(); set new HashSet<>() for (int s : S) {
            set.add(s);
        } int s S {
            set.add(s);
        } {
            set.add(s);
        } set.add(s) set.add set s int cnt = 0; cnt 0 for (int t : T) {
            if (set.contains(t)) {
                cnt++;
            }
        } int t T {
            if (set.contains(t)) {
                cnt++;
            }
        } {
            if (set.contains(t)) {
                cnt++;
            }
        } if (set.contains(t)) {
                cnt++;
            } set.contains(t) set.contains set t {
                cnt++;
            } cnt++ cnt System.out.println(cnt) System.out.println System.out System System.out cnt public static void main(String[] args) {
        new Main().solve();
    } main {
        new Main().solve();
    } new Main().solve() new Main().solve new Main() String[] args args public class Main {

    Scanner sc = new Scanner(System.in);

    void solve() {
        // Input
        int n = sc.nextInt();
        int[] S = new int[n];
        for (int i = 0; i < n; i++) {
            S[i] = sc.nextInt();
        }
        int q = sc.nextInt();
        int[] T = new int[q];
        for (int i = 0; i < q; i++) {
            T[i] = sc.nextInt();
        }
        // Solve
        Set<Integer> set = new HashSet<>();
        for (int s : S) {
            set.add(s);
        }
        int cnt = 0;
        for (int t : T) {
            if (set.contains(t)) {
                cnt++;
            }
        }
        // Output
        System.out.println(cnt);
    }

    public static void main(String[] args) {
        new Main().solve();
    }
} public class Main {

    Scanner sc = new Scanner(System.in);

    void solve() {
        // Input
        int n = sc.nextInt();
        int[] S = new int[n];
        for (int i = 0; i < n; i++) {
            S[i] = sc.nextInt();
        }
        int q = sc.nextInt();
        int[] T = new int[q];
        for (int i = 0; i < q; i++) {
            T[i] = sc.nextInt();
        }
        // Solve
        Set<Integer> set = new HashSet<>();
        for (int s : S) {
            set.add(s);
        }
        int cnt = 0;
        for (int t : T) {
            if (set.contains(t)) {
                cnt++;
            }
        }
        // Output
        System.out.println(cnt);
    }

    public static void main(String[] args) {
        new Main().solve();
    }
} Main
import java.util.*;

public class Main {

    Scanner sc = new Scanner(System.in);

    void solve() {
        // Input
        int n = sc.nextInt();
        int[] S = new int[n];
        for (int i = 0; i < n; i++) {
            S[i] = sc.nextInt();
        }
        int q = sc.nextInt();
        int[] T = new int[q];
        for (int i = 0; i < q; i++) {
            T[i] = sc.nextInt();
        }
        // Solve
        Set<Integer> set = new HashSet<>();
        for (int s : S) {
            set.add(s);
        }
        int cnt = 0;
        for (int t : T) {
            if (set.contains(t)) {
                cnt++;
            }
        }
        // Output
        System.out.println(cnt);
    }

    public static void main(String[] args) {
        new Main().solve();
    }
}

