import java.util.Scanner;

public class Main {

    static int NOT_FOUND = 99999999;

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] sArr = new int[n];
        for (int i = 0; i < n; i++) {
            sArr[i] = sc.nextInt();
        }

        int q = sc.nextInt();
        int[] tArr = new int[q];
        int count = 0;
        for (int i = 0; i < q; i++) {
            int x = sc.nextInt();
            tArr[i] = x;
            if (binarySearch(sArr, x) != NOT_FOUND) count++;
        }
        System.out.println(count);
    }

    public static int binarySearch(int[] arr, int key) {
        int n = arr.length;
        int left = 0;
        int right = n;

        while (left < right) {
            int mid = (left + right) / 2;
            if (arr[mid] == key) {
                return mid;
            } else if (key < arr[mid]) {
                right = mid;
            } else {
                left = mid + 1;
            }
        }
        return NOT_FOUND;
    }
}
 import java.util.Scanner; Scanner java.util public class Main {

    static int NOT_FOUND = 99999999;

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] sArr = new int[n];
        for (int i = 0; i < n; i++) {
            sArr[i] = sc.nextInt();
        }

        int q = sc.nextInt();
        int[] tArr = new int[q];
        int count = 0;
        for (int i = 0; i < q; i++) {
            int x = sc.nextInt();
            tArr[i] = x;
            if (binarySearch(sArr, x) != NOT_FOUND) count++;
        }
        System.out.println(count);
    }

    public static int binarySearch(int[] arr, int key) {
        int n = arr.length;
        int left = 0;
        int right = n;

        while (left < right) {
            int mid = (left + right) / 2;
            if (arr[mid] == key) {
                return mid;
            } else if (key < arr[mid]) {
                right = mid;
            } else {
                left = mid + 1;
            }
        }
        return NOT_FOUND;
    }
} Main static int NOT_FOUND = 99999999; NOT_FOUND 99999999 public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] sArr = new int[n];
        for (int i = 0; i < n; i++) {
            sArr[i] = sc.nextInt();
        }

        int q = sc.nextInt();
        int[] tArr = new int[q];
        int count = 0;
        for (int i = 0; i < q; i++) {
            int x = sc.nextInt();
            tArr[i] = x;
            if (binarySearch(sArr, x) != NOT_FOUND) count++;
        }
        System.out.println(count);
    } main {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] sArr = new int[n];
        for (int i = 0; i < n; i++) {
            sArr[i] = sc.nextInt();
        }

        int q = sc.nextInt();
        int[] tArr = new int[q];
        int count = 0;
        for (int i = 0; i < q; i++) {
            int x = sc.nextInt();
            tArr[i] = x;
            if (binarySearch(sArr, x) != NOT_FOUND) count++;
        }
        System.out.println(count);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] sArr = new int[n]; sArr new int[n] n for (int i = 0; i < n; i++) {
            sArr[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            sArr[i] = sc.nextInt();
        } {
            sArr[i] = sc.nextInt();
        } sArr[i] = sc.nextInt() sArr[i] sArr i sc.nextInt() sc.nextInt sc int q = sc.nextInt(); q sc.nextInt() sc.nextInt sc int[] tArr = new int[q]; tArr new int[q] q int count = 0; count 0 for (int i = 0; i < q; i++) {
            int x = sc.nextInt();
            tArr[i] = x;
            if (binarySearch(sArr, x) != NOT_FOUND) count++;
        } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
            int x = sc.nextInt();
            tArr[i] = x;
            if (binarySearch(sArr, x) != NOT_FOUND) count++;
        } {
            int x = sc.nextInt();
            tArr[i] = x;
            if (binarySearch(sArr, x) != NOT_FOUND) count++;
        } int x = sc.nextInt(); x sc.nextInt() sc.nextInt sc tArr[i] = x tArr[i] tArr i x if (binarySearch(sArr, x) != NOT_FOUND) count++; binarySearch(sArr, x) != NOT_FOUND binarySearch(sArr, x) binarySearch sArr x NOT_FOUND count++ count System.out.println(count) System.out.println System.out System System.out count String[] args args public static int binarySearch(int[] arr, int key) {
        int n = arr.length;
        int left = 0;
        int right = n;

        while (left < right) {
            int mid = (left + right) / 2;
            if (arr[mid] == key) {
                return mid;
            } else if (key < arr[mid]) {
                right = mid;
            } else {
                left = mid + 1;
            }
        }
        return NOT_FOUND;
    } binarySearch {
        int n = arr.length;
        int left = 0;
        int right = n;

        while (left < right) {
            int mid = (left + right) / 2;
            if (arr[mid] == key) {
                return mid;
            } else if (key < arr[mid]) {
                right = mid;
            } else {
                left = mid + 1;
            }
        }
        return NOT_FOUND;
    } int n = arr.length; n arr.length arr arr.length int left = 0; left 0 int right = n; right n while (left < right) {
            int mid = (left + right) / 2;
            if (arr[mid] == key) {
                return mid;
            } else if (key < arr[mid]) {
                right = mid;
            } else {
                left = mid + 1;
            }
        } left < right left right {
            int mid = (left + right) / 2;
            if (arr[mid] == key) {
                return mid;
            } else if (key < arr[mid]) {
                right = mid;
            } else {
                left = mid + 1;
            }
        } int mid = (left + right) / 2; mid (left + right) / 2 (left + right) left right 2 if (arr[mid] == key) {
                return mid;
            } else if (key < arr[mid]) {
                right = mid;
            } else {
                left = mid + 1;
            } arr[mid] == key arr[mid] arr mid key {
                return mid;
            } return mid; mid if (key < arr[mid]) {
                right = mid;
            } else {
                left = mid + 1;
            } key < arr[mid] key arr[mid] arr mid {
                right = mid;
            } right = mid right mid {
                left = mid + 1;
            } left = mid + 1 left mid + 1 mid 1 return NOT_FOUND; NOT_FOUND int[] arr arr int key key public class Main {

    static int NOT_FOUND = 99999999;

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] sArr = new int[n];
        for (int i = 0; i < n; i++) {
            sArr[i] = sc.nextInt();
        }

        int q = sc.nextInt();
        int[] tArr = new int[q];
        int count = 0;
        for (int i = 0; i < q; i++) {
            int x = sc.nextInt();
            tArr[i] = x;
            if (binarySearch(sArr, x) != NOT_FOUND) count++;
        }
        System.out.println(count);
    }

    public static int binarySearch(int[] arr, int key) {
        int n = arr.length;
        int left = 0;
        int right = n;

        while (left < right) {
            int mid = (left + right) / 2;
            if (arr[mid] == key) {
                return mid;
            } else if (key < arr[mid]) {
                right = mid;
            } else {
                left = mid + 1;
            }
        }
        return NOT_FOUND;
    }
} public class Main {

    static int NOT_FOUND = 99999999;

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] sArr = new int[n];
        for (int i = 0; i < n; i++) {
            sArr[i] = sc.nextInt();
        }

        int q = sc.nextInt();
        int[] tArr = new int[q];
        int count = 0;
        for (int i = 0; i < q; i++) {
            int x = sc.nextInt();
            tArr[i] = x;
            if (binarySearch(sArr, x) != NOT_FOUND) count++;
        }
        System.out.println(count);
    }

    public static int binarySearch(int[] arr, int key) {
        int n = arr.length;
        int left = 0;
        int right = n;

        while (left < right) {
            int mid = (left + right) / 2;
            if (arr[mid] == key) {
                return mid;
            } else if (key < arr[mid]) {
                right = mid;
            } else {
                left = mid + 1;
            }
        }
        return NOT_FOUND;
    }
} Main
import java.util.Scanner;

public class Main {

    static int NOT_FOUND = 99999999;

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] sArr = new int[n];
        for (int i = 0; i < n; i++) {
            sArr[i] = sc.nextInt();
        }

        int q = sc.nextInt();
        int[] tArr = new int[q];
        int count = 0;
        for (int i = 0; i < q; i++) {
            int x = sc.nextInt();
            tArr[i] = x;
            if (binarySearch(sArr, x) != NOT_FOUND) count++;
        }
        System.out.println(count);
    }

    public static int binarySearch(int[] arr, int key) {
        int n = arr.length;
        int left = 0;
        int right = n;

        while (left < right) {
            int mid = (left + right) / 2;
            if (arr[mid] == key) {
                return mid;
            } else if (key < arr[mid]) {
                right = mid;
            } else {
                left = mid + 1;
            }
        }
        return NOT_FOUND;
    }
}

