#include<stdio.h>
#define N 10000

int binarySearch(int [],int,int);
int main(){
    int A[N],i,n,q,key,x,count=0;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&A[i]);
    }
    scanf("%d",&q);
    for(i=0;i<q;i++){
        scanf("%d",&key);
        x= binarySearch(A,n,key);
        if(x==1) count++;
    }
    printf("%d\n",count);
    
    return 0;
}

int  binarySearch(int A[],int n, int key){
    int left=0;
    int right =n;
   
    while(left<right){
        int mid=(left+right)/2;
        if(A[mid]==key) return 1;
        else if(key>A[mid]) right=mid;
        else left = mid+1;right=mid;
    }
    return n+1;
    
}

