import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        long[] S = new long[n];
        for (int i = 0; i < n; i++) S[i] = Integer.parseInt(sc.next());

        int cnt = 0;

        int q = Integer.parseInt(sc.next());
        for (int i = 0; i < q; i++) {
            long T = Integer.parseInt(sc.next());
            if (search(S, n, T)) cnt++;
        }
        System.out.println(cnt);
    }

    private static boolean search(long[] A, int n, long key) {
//        return Arrays.binarySearch(A, key) >= 0;
        int l = 0;
        int r = n;
        while (l < r) {
            int m = (l + r) / 2;
            if (A[m] == key) {
                return true;
            } else if (key < A[m]) {
                r = m;
            } else {
                l = m + 1;
            }
        }
        return false;
    }
}
 import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        long[] S = new long[n];
        for (int i = 0; i < n; i++) S[i] = Integer.parseInt(sc.next());

        int cnt = 0;

        int q = Integer.parseInt(sc.next());
        for (int i = 0; i < q; i++) {
            long T = Integer.parseInt(sc.next());
            if (search(S, n, T)) cnt++;
        }
        System.out.println(cnt);
    }

    private static boolean search(long[] A, int n, long key) {
//        return Arrays.binarySearch(A, key) >= 0;
        int l = 0;
        int r = n;
        while (l < r) {
            int m = (l + r) / 2;
            if (A[m] == key) {
                return true;
            } else if (key < A[m]) {
                r = m;
            } else {
                l = m + 1;
            }
        }
        return false;
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        long[] S = new long[n];
        for (int i = 0; i < n; i++) S[i] = Integer.parseInt(sc.next());

        int cnt = 0;

        int q = Integer.parseInt(sc.next());
        for (int i = 0; i < q; i++) {
            long T = Integer.parseInt(sc.next());
            if (search(S, n, T)) cnt++;
        }
        System.out.println(cnt);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        long[] S = new long[n];
        for (int i = 0; i < n; i++) S[i] = Integer.parseInt(sc.next());

        int cnt = 0;

        int q = Integer.parseInt(sc.next());
        for (int i = 0; i < q; i++) {
            long T = Integer.parseInt(sc.next());
            if (search(S, n, T)) cnt++;
        }
        System.out.println(cnt);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc long[] S = new long[n]; S new long[n] n for (int i = 0; i < n; i++) S[i] = Integer.parseInt(sc.next()); int i = 0; int i = 0; i 0 i < n i n i++ i++ i S[i] = Integer.parseInt(sc.next()); S[i] = Integer.parseInt(sc.next()) S[i] S i Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int cnt = 0; cnt 0 int q = Integer.parseInt(sc.next()); q Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc for (int i = 0; i < q; i++) {
            long T = Integer.parseInt(sc.next());
            if (search(S, n, T)) cnt++;
        } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
            long T = Integer.parseInt(sc.next());
            if (search(S, n, T)) cnt++;
        } {
            long T = Integer.parseInt(sc.next());
            if (search(S, n, T)) cnt++;
        } long T = Integer.parseInt(sc.next()); T Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc if (search(S, n, T)) cnt++; search(S, n, T) search S n T cnt++ cnt System.out.println(cnt) System.out.println System.out System System.out cnt String[] args args private static boolean search(long[] A, int n, long key) {
//        return Arrays.binarySearch(A, key) >= 0;
        int l = 0;
        int r = n;
        while (l < r) {
            int m = (l + r) / 2;
            if (A[m] == key) {
                return true;
            } else if (key < A[m]) {
                r = m;
            } else {
                l = m + 1;
            }
        }
        return false;
    } search {
//        return Arrays.binarySearch(A, key) >= 0;
        int l = 0;
        int r = n;
        while (l < r) {
            int m = (l + r) / 2;
            if (A[m] == key) {
                return true;
            } else if (key < A[m]) {
                r = m;
            } else {
                l = m + 1;
            }
        }
        return false;
    } int l = 0; l 0 int r = n; r n while (l < r) {
            int m = (l + r) / 2;
            if (A[m] == key) {
                return true;
            } else if (key < A[m]) {
                r = m;
            } else {
                l = m + 1;
            }
        } l < r l r {
            int m = (l + r) / 2;
            if (A[m] == key) {
                return true;
            } else if (key < A[m]) {
                r = m;
            } else {
                l = m + 1;
            }
        } int m = (l + r) / 2; m (l + r) / 2 (l + r) l r 2 if (A[m] == key) {
                return true;
            } else if (key < A[m]) {
                r = m;
            } else {
                l = m + 1;
            } A[m] == key A[m] A m key {
                return true;
            } return true; true if (key < A[m]) {
                r = m;
            } else {
                l = m + 1;
            } key < A[m] key A[m] A m {
                r = m;
            } r = m r m {
                l = m + 1;
            } l = m + 1 l m + 1 m 1 return false; false long[] A A int n n long key key public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        long[] S = new long[n];
        for (int i = 0; i < n; i++) S[i] = Integer.parseInt(sc.next());

        int cnt = 0;

        int q = Integer.parseInt(sc.next());
        for (int i = 0; i < q; i++) {
            long T = Integer.parseInt(sc.next());
            if (search(S, n, T)) cnt++;
        }
        System.out.println(cnt);
    }

    private static boolean search(long[] A, int n, long key) {
//        return Arrays.binarySearch(A, key) >= 0;
        int l = 0;
        int r = n;
        while (l < r) {
            int m = (l + r) / 2;
            if (A[m] == key) {
                return true;
            } else if (key < A[m]) {
                r = m;
            } else {
                l = m + 1;
            }
        }
        return false;
    }
} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        long[] S = new long[n];
        for (int i = 0; i < n; i++) S[i] = Integer.parseInt(sc.next());

        int cnt = 0;

        int q = Integer.parseInt(sc.next());
        for (int i = 0; i < q; i++) {
            long T = Integer.parseInt(sc.next());
            if (search(S, n, T)) cnt++;
        }
        System.out.println(cnt);
    }

    private static boolean search(long[] A, int n, long key) {
//        return Arrays.binarySearch(A, key) >= 0;
        int l = 0;
        int r = n;
        while (l < r) {
            int m = (l + r) / 2;
            if (A[m] == key) {
                return true;
            } else if (key < A[m]) {
                r = m;
            } else {
                l = m + 1;
            }
        }
        return false;
    }
} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        long[] S = new long[n];
        for (int i = 0; i < n; i++) S[i] = Integer.parseInt(sc.next());

        int cnt = 0;

        int q = Integer.parseInt(sc.next());
        for (int i = 0; i < q; i++) {
            long T = Integer.parseInt(sc.next());
            if (search(S, n, T)) cnt++;
        }
        System.out.println(cnt);
    }

    private static boolean search(long[] A, int n, long key) {
//        return Arrays.binarySearch(A, key) >= 0;
        int l = 0;
        int r = n;
        while (l < r) {
            int m = (l + r) / 2;
            if (A[m] == key) {
                return true;
            } else if (key < A[m]) {
                r = m;
            } else {
                l = m + 1;
            }
        }
        return false;
    }
}

