import java.io.*;

public class Main{

    static boolean binarySearch(int[] s, int n, int key){
        int left = 0;
        int right = n - 1;
        while(left <= right){
            int mid = (left + right) / 2;
            if(s[mid] == key){
                return true;
            }else if(s[mid] < key){
                left = mid + 1;
            }else if(key < s[mid]){
                right = mid - 1;
            }
        }

        return false;
    }
    public static void main(String[] args){
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

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

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

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

        System.out.println(count);        
        }catch(IOException e){
            e.printStackTrace();
        }
    }
}

/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