import java.io.*;

class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        String[] input;
        int i;

        int n = Integer.parseInt(br.readLine());
        input = br.readLine().split(" ");
        int[] s = new int[n];
        for (i = 0; i < n; i++) {
            s[i] = Integer.parseInt(input[i]);
        }

        int q = Integer.parseInt(br.readLine());
        input = br.readLine().split(" ");
        int[] t = new int[q];
        for (i = 0; i < q; i++) {
            t[i] = Integer.parseInt(input[i]);
        }

        int count = 0;
        for (i = 0; i < q; i++) {
            if (binarySearch(s, t[i], 0, n - 1)) count++;
        }

        System.out.println(count);
    }

    public static boolean binarySearch(int[] arr, int target, int left, int right) {
        if (left > right) return false;

        int m = (left + right) / 2;
        if (arr[m] < target) return binarySearch(arr, target, m + 1, right);
        else if (arr[m] > target) return binarySearch(arr, target, left, m - 1);
        else return true;
    }
}
/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz