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

public class Main {
    static int[] a;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        int q = sc.nextInt();
        int c = 0;
        for (int i = 0; i < q; i++) {
            int t = sc.nextInt();
            // if (binarySearchContains(t)) {
            //     c++;
            // }
            if (Arrays.binarySearch(a, t) >= 0) {
                c++;
            }
        }
        System.out.println(c);
    }

    public static boolean binarySearchContains(int v) {
        int l = 0; // left
        int r = a.length - 1; // right
        while (l <= r) {
            int m = (r + l) / 2;
            if (a[m] == v) {
                return true;
            }
            if (a[m] > v) {
                r = m - 1;
            } else {
                l = m + 1;
            }
        }
        return false;
    }
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
    static int[] a;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        int q = sc.nextInt();
        int c = 0;
        for (int i = 0; i < q; i++) {
            int t = sc.nextInt();
            // if (binarySearchContains(t)) {
            //     c++;
            // }
            if (Arrays.binarySearch(a, t) >= 0) {
                c++;
            }
        }
        System.out.println(c);
    }

    public static boolean binarySearchContains(int v) {
        int l = 0; // left
        int r = a.length - 1; // right
        while (l <= r) {
            int m = (r + l) / 2;
            if (a[m] == v) {
                return true;
            }
            if (a[m] > v) {
                r = m - 1;
            } else {
                l = m + 1;
            }
        }
        return false;
    }
} Main static int[] a; a public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        int q = sc.nextInt();
        int c = 0;
        for (int i = 0; i < q; i++) {
            int t = sc.nextInt();
            // if (binarySearchContains(t)) {
            //     c++;
            // }
            if (Arrays.binarySearch(a, t) >= 0) {
                c++;
            }
        }
        System.out.println(c);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        int q = sc.nextInt();
        int c = 0;
        for (int i = 0; i < q; i++) {
            int t = sc.nextInt();
            // if (binarySearchContains(t)) {
            //     c++;
            // }
            if (Arrays.binarySearch(a, t) >= 0) {
                c++;
            }
        }
        System.out.println(c);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc a = new int[n] a new int[n] n for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            a[i] = sc.nextInt();
        } {
            a[i] = sc.nextInt();
        } a[i] = sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc int q = sc.nextInt(); q sc.nextInt() sc.nextInt sc int c = 0; c 0 for (int i = 0; i < q; i++) {
            int t = sc.nextInt();
            // if (binarySearchContains(t)) {
            //     c++;
            // }
            if (Arrays.binarySearch(a, t) >= 0) {
                c++;
            }
        } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
            int t = sc.nextInt();
            // if (binarySearchContains(t)) {
            //     c++;
            // }
            if (Arrays.binarySearch(a, t) >= 0) {
                c++;
            }
        } {
            int t = sc.nextInt();
            // if (binarySearchContains(t)) {
            //     c++;
            // }
            if (Arrays.binarySearch(a, t) >= 0) {
                c++;
            }
        } int t = sc.nextInt(); t sc.nextInt() sc.nextInt sc if (Arrays.binarySearch(a, t) >= 0) {
                c++;
            } Arrays.binarySearch(a, t) >= 0 Arrays.binarySearch(a, t) Arrays.binarySearch Arrays a t 0 {
                c++;
            } c++ c System.out.println(c) System.out.println System.out System System.out c String[] args args public static boolean binarySearchContains(int v) {
        int l = 0; // left
        int r = a.length - 1; // right
        while (l <= r) {
            int m = (r + l) / 2;
            if (a[m] == v) {
                return true;
            }
            if (a[m] > v) {
                r = m - 1;
            } else {
                l = m + 1;
            }
        }
        return false;
    } binarySearchContains {
        int l = 0; // left
        int r = a.length - 1; // right
        while (l <= r) {
            int m = (r + l) / 2;
            if (a[m] == v) {
                return true;
            }
            if (a[m] > v) {
                r = m - 1;
            } else {
                l = m + 1;
            }
        }
        return false;
    } int l = 0; l 0 int r = a.length - 1; r a.length - 1 a.length a a.length 1 while (l <= r) {
            int m = (r + l) / 2;
            if (a[m] == v) {
                return true;
            }
            if (a[m] > v) {
                r = m - 1;
            } else {
                l = m + 1;
            }
        } l <= r l r {
            int m = (r + l) / 2;
            if (a[m] == v) {
                return true;
            }
            if (a[m] > v) {
                r = m - 1;
            } else {
                l = m + 1;
            }
        } int m = (r + l) / 2; m (r + l) / 2 (r + l) r l 2 if (a[m] == v) {
                return true;
            } a[m] == v a[m] a m v {
                return true;
            } return true; true if (a[m] > v) {
                r = m - 1;
            } else {
                l = m + 1;
            } a[m] > v a[m] a m v {
                r = m - 1;
            } r = m - 1 r m - 1 m 1 {
                l = m + 1;
            } l = m + 1 l m + 1 m 1 return false; false int v v public class Main {
    static int[] a;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        int q = sc.nextInt();
        int c = 0;
        for (int i = 0; i < q; i++) {
            int t = sc.nextInt();
            // if (binarySearchContains(t)) {
            //     c++;
            // }
            if (Arrays.binarySearch(a, t) >= 0) {
                c++;
            }
        }
        System.out.println(c);
    }

    public static boolean binarySearchContains(int v) {
        int l = 0; // left
        int r = a.length - 1; // right
        while (l <= r) {
            int m = (r + l) / 2;
            if (a[m] == v) {
                return true;
            }
            if (a[m] > v) {
                r = m - 1;
            } else {
                l = m + 1;
            }
        }
        return false;
    }
} public class Main {
    static int[] a;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        int q = sc.nextInt();
        int c = 0;
        for (int i = 0; i < q; i++) {
            int t = sc.nextInt();
            // if (binarySearchContains(t)) {
            //     c++;
            // }
            if (Arrays.binarySearch(a, t) >= 0) {
                c++;
            }
        }
        System.out.println(c);
    }

    public static boolean binarySearchContains(int v) {
        int l = 0; // left
        int r = a.length - 1; // right
        while (l <= r) {
            int m = (r + l) / 2;
            if (a[m] == v) {
                return true;
            }
            if (a[m] > v) {
                r = m - 1;
            } else {
                l = m + 1;
            }
        }
        return false;
    }
} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    static int[] a;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        int q = sc.nextInt();
        int c = 0;
        for (int i = 0; i < q; i++) {
            int t = sc.nextInt();
            // if (binarySearchContains(t)) {
            //     c++;
            // }
            if (Arrays.binarySearch(a, t) >= 0) {
                c++;
            }
        }
        System.out.println(c);
    }

    public static boolean binarySearchContains(int v) {
        int l = 0; // left
        int r = a.length - 1; // right
        while (l <= r) {
            int m = (r + l) / 2;
            if (a[m] == v) {
                return true;
            }
            if (a[m] > v) {
                r = m - 1;
            } else {
                l = m + 1;
            }
        }
        return false;
    }
}