import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] s = new int[n + 1];
        for (int i = 0; i < n; i++) {
            s[i] = scanner.nextInt();
        }
        int q = scanner.nextInt();
        int[] t = new int[q];
        for (int i = 0; i < q; i++) {
            t[i] = scanner.nextInt();
        }
        int count = 0;
        for (int i = 0; i < q; i++) {
            if (LinearSearch(s, t[i])) {
                count++;
            }
        }
        System.out.println(count);
    }

    static boolean LinearSearch(int[] a, int key) {
        int i = 0;
        a[a.length - 1] = key;
        while (a[i] != key) {
            i++;
        }
        if (i == a.length - 1) {
            return false;
        }
        return true;
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] s = new int[n + 1];
        for (int i = 0; i < n; i++) {
            s[i] = scanner.nextInt();
        }
        int q = scanner.nextInt();
        int[] t = new int[q];
        for (int i = 0; i < q; i++) {
            t[i] = scanner.nextInt();
        }
        int count = 0;
        for (int i = 0; i < q; i++) {
            if (LinearSearch(s, t[i])) {
                count++;
            }
        }
        System.out.println(count);
    }

    static boolean LinearSearch(int[] a, int key) {
        int i = 0;
        a[a.length - 1] = key;
        while (a[i] != key) {
            i++;
        }
        if (i == a.length - 1) {
            return false;
        }
        return true;
    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] s = new int[n + 1];
        for (int i = 0; i < n; i++) {
            s[i] = scanner.nextInt();
        }
        int q = scanner.nextInt();
        int[] t = new int[q];
        for (int i = 0; i < q; i++) {
            t[i] = scanner.nextInt();
        }
        int count = 0;
        for (int i = 0; i < q; i++) {
            if (LinearSearch(s, t[i])) {
                count++;
            }
        }
        System.out.println(count);
    } main {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] s = new int[n + 1];
        for (int i = 0; i < n; i++) {
            s[i] = scanner.nextInt();
        }
        int q = scanner.nextInt();
        int[] t = new int[q];
        for (int i = 0; i < q; i++) {
            t[i] = scanner.nextInt();
        }
        int count = 0;
        for (int i = 0; i < q; i++) {
            if (LinearSearch(s, t[i])) {
                count++;
            }
        }
        System.out.println(count);
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int n = scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner int[] s = new int[n + 1]; s new int[n + 1] n + 1 n 1 for (int i = 0; i < n; i++) {
            s[i] = scanner.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            s[i] = scanner.nextInt();
        } {
            s[i] = scanner.nextInt();
        } s[i] = scanner.nextInt() s[i] s i scanner.nextInt() scanner.nextInt scanner int q = scanner.nextInt(); q scanner.nextInt() scanner.nextInt scanner int[] t = new int[q]; t new int[q] q for (int i = 0; i < q; i++) {
            t[i] = scanner.nextInt();
        } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
            t[i] = scanner.nextInt();
        } {
            t[i] = scanner.nextInt();
        } t[i] = scanner.nextInt() t[i] t i scanner.nextInt() scanner.nextInt scanner int count = 0; count 0 for (int i = 0; i < q; i++) {
            if (LinearSearch(s, t[i])) {
                count++;
            }
        } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
            if (LinearSearch(s, t[i])) {
                count++;
            }
        } {
            if (LinearSearch(s, t[i])) {
                count++;
            }
        } if (LinearSearch(s, t[i])) {
                count++;
            } LinearSearch(s, t[i]) LinearSearch s t[i] t i {
                count++;
            } count++ count System.out.println(count) System.out.println System.out System System.out count String[] args args static boolean LinearSearch(int[] a, int key) {
        int i = 0;
        a[a.length - 1] = key;
        while (a[i] != key) {
            i++;
        }
        if (i == a.length - 1) {
            return false;
        }
        return true;
    } LinearSearch {
        int i = 0;
        a[a.length - 1] = key;
        while (a[i] != key) {
            i++;
        }
        if (i == a.length - 1) {
            return false;
        }
        return true;
    } int i = 0; i 0 a[a.length - 1] = key a[a.length - 1] a a.length - 1 a.length a a.length 1 key while (a[i] != key) {
            i++;
        } a[i] != key a[i] a i key {
            i++;
        } i++ i if (i == a.length - 1) {
            return false;
        } i == a.length - 1 i a.length - 1 a.length a a.length 1 {
            return false;
        } return false; false return true; true int[] a a int key key public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] s = new int[n + 1];
        for (int i = 0; i < n; i++) {
            s[i] = scanner.nextInt();
        }
        int q = scanner.nextInt();
        int[] t = new int[q];
        for (int i = 0; i < q; i++) {
            t[i] = scanner.nextInt();
        }
        int count = 0;
        for (int i = 0; i < q; i++) {
            if (LinearSearch(s, t[i])) {
                count++;
            }
        }
        System.out.println(count);
    }

    static boolean LinearSearch(int[] a, int key) {
        int i = 0;
        a[a.length - 1] = key;
        while (a[i] != key) {
            i++;
        }
        if (i == a.length - 1) {
            return false;
        }
        return true;
    }
} public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] s = new int[n + 1];
        for (int i = 0; i < n; i++) {
            s[i] = scanner.nextInt();
        }
        int q = scanner.nextInt();
        int[] t = new int[q];
        for (int i = 0; i < q; i++) {
            t[i] = scanner.nextInt();
        }
        int count = 0;
        for (int i = 0; i < q; i++) {
            if (LinearSearch(s, t[i])) {
                count++;
            }
        }
        System.out.println(count);
    }

    static boolean LinearSearch(int[] a, int key) {
        int i = 0;
        a[a.length - 1] = key;
        while (a[i] != key) {
            i++;
        }
        if (i == a.length - 1) {
            return false;
        }
        return true;
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] s = new int[n + 1];
        for (int i = 0; i < n; i++) {
            s[i] = scanner.nextInt();
        }
        int q = scanner.nextInt();
        int[] t = new int[q];
        for (int i = 0; i < q; i++) {
            t[i] = scanner.nextInt();
        }
        int count = 0;
        for (int i = 0; i < q; i++) {
            if (LinearSearch(s, t[i])) {
                count++;
            }
        }
        System.out.println(count);
    }

    static boolean LinearSearch(int[] a, int key) {
        int i = 0;
        a[a.length - 1] = key;
        while (a[i] != key) {
            i++;
        }
        if (i == a.length - 1) {
            return false;
        }
        return true;
    }
}
