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];
        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 (BinarySearch(s, t[i])) {
                count++;
            }
        }
        System.out.println(count);
    }

    static boolean BinarySearch(int[] a, int key) {
        int left = 0;
        int right = a.length;
        while (left < right) {
            int mid = (left + right) / 2;
            if (a[mid] == key) {
                return true;
            }
            else if (key < a[mid]) {
                right = mid;
            }
            else {
                left = mid + 1;
            }
        } 
        return false;
    }
}
 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];
        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 (BinarySearch(s, t[i])) {
                count++;
            }
        }
        System.out.println(count);
    }

    static boolean BinarySearch(int[] a, int key) {
        int left = 0;
        int right = a.length;
        while (left < right) {
            int mid = (left + right) / 2;
            if (a[mid] == key) {
                return true;
            }
            else if (key < a[mid]) {
                right = mid;
            }
            else {
                left = mid + 1;
            }
        } 
        return false;
    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] s = new int[n];
        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 (BinarySearch(s, t[i])) {
                count++;
            }
        }
        System.out.println(count);
    } main {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] s = new int[n];
        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 (BinarySearch(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]; s new int[n] n 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 (BinarySearch(s, t[i])) {
                count++;
            }
        } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
            if (BinarySearch(s, t[i])) {
                count++;
            }
        } {
            if (BinarySearch(s, t[i])) {
                count++;
            }
        } if (BinarySearch(s, t[i])) {
                count++;
            } BinarySearch(s, t[i]) BinarySearch 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 BinarySearch(int[] a, int key) {
        int left = 0;
        int right = a.length;
        while (left < right) {
            int mid = (left + right) / 2;
            if (a[mid] == key) {
                return true;
            }
            else if (key < a[mid]) {
                right = mid;
            }
            else {
                left = mid + 1;
            }
        } 
        return false;
    } BinarySearch {
        int left = 0;
        int right = a.length;
        while (left < right) {
            int mid = (left + right) / 2;
            if (a[mid] == key) {
                return true;
            }
            else if (key < a[mid]) {
                right = mid;
            }
            else {
                left = mid + 1;
            }
        } 
        return false;
    } int left = 0; left 0 int right = a.length; right a.length a a.length while (left < right) {
            int mid = (left + right) / 2;
            if (a[mid] == key) {
                return true;
            }
            else if (key < a[mid]) {
                right = mid;
            }
            else {
                left = mid + 1;
            }
        } left < right left right {
            int mid = (left + right) / 2;
            if (a[mid] == key) {
                return true;
            }
            else if (key < a[mid]) {
                right = mid;
            }
            else {
                left = mid + 1;
            }
        } int mid = (left + right) / 2; mid (left + right) / 2 (left + right) left right 2 if (a[mid] == key) {
                return true;
            }
            else if (key < a[mid]) {
                right = mid;
            }
            else {
                left = mid + 1;
            } a[mid] == key a[mid] a mid key {
                return true;
            } return true; true if (key < a[mid]) {
                right = mid;
            }
            else {
                left = mid + 1;
            } key < a[mid] key a[mid] a mid {
                right = mid;
            } right = mid right mid {
                left = mid + 1;
            } left = mid + 1 left mid + 1 mid 1 return false; false 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];
        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 (BinarySearch(s, t[i])) {
                count++;
            }
        }
        System.out.println(count);
    }

    static boolean BinarySearch(int[] a, int key) {
        int left = 0;
        int right = a.length;
        while (left < right) {
            int mid = (left + right) / 2;
            if (a[mid] == key) {
                return true;
            }
            else if (key < a[mid]) {
                right = mid;
            }
            else {
                left = mid + 1;
            }
        } 
        return false;
    }
} public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] s = new int[n];
        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 (BinarySearch(s, t[i])) {
                count++;
            }
        }
        System.out.println(count);
    }

    static boolean BinarySearch(int[] a, int key) {
        int left = 0;
        int right = a.length;
        while (left < right) {
            int mid = (left + right) / 2;
            if (a[mid] == key) {
                return true;
            }
            else if (key < a[mid]) {
                right = mid;
            }
            else {
                left = mid + 1;
            }
        } 
        return false;
    }
} 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];
        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 (BinarySearch(s, t[i])) {
                count++;
            }
        }
        System.out.println(count);
    }

    static boolean BinarySearch(int[] a, int key) {
        int left = 0;
        int right = a.length;
        while (left < right) {
            int mid = (left + right) / 2;
            if (a[mid] == key) {
                return true;
            }
            else if (key < a[mid]) {
                right = mid;
            }
            else {
                left = mid + 1;
            }
        } 
        return false;
    }
}

