import java.util.*;

public class Main {
    static int calu(int n, int m, int A[], int S[]) {
        int count=0;
        for(int i=0;i<m;i++){
            count+=bsearch(S[i],A,0,n);
        }
        return count;
    }
    static int bsearch(int si,int A[],int left,int right)
    {   
        while (left < right){
            int mid = (left + right) / 2;
            if (A[mid] == si) return 1;
            else if (si < A[mid]) right = mid;
            else left = mid + 1;
        }
        return 0;
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] A,S;
        A = new int[n]; 
        for(int i = 0; i < n; i++) {
            A[i] = sc.nextInt();
        }
        int m = sc.nextInt();
        S = new int[m];
        for(int i = 0; i < m; i++) {
            S[i] = sc.nextInt();
        }
        System.out.println(calu(n,m,A,S));
        sc.close();
    }
}

/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