import java.util.Scanner;
public class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int [] s = new int[n];
        int [] t;
        for (int x = 0; x < n; x++){
            s[x] = scan.nextInt();
        }
        int q = scan.nextInt();
        t = new int[q];
        for (int x = 0; x < q; x++){
            t[x] = scan.nextInt();
        }
        int counter = 0;
        for (int x = 0; x < q; x++){
            if(t[x] <= s[n -1] && t[x] >= s[0]){
                if(binarysearch(s, 0, n - 1, t[x])){
                    counter++;
                }
            }
        }
        System.out.println(counter);
    }
    public static boolean binarysearch(int arr[], int l, int r, int x){
        if(r >=l){
            int mid = (l + r)/2;
            if(arr[mid] == x){
                return true;
            }
            else if(arr[mid] > x){
                return binarysearch(arr, l, mid -1, x);
            }
            else{
                return binarysearch(arr, mid + 1, r, x);
            }
        }
        else{
         return false;
        }
    }
}

/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