#include <stdio.h>

int main(int argc , char *argv[]){
    int n,q;
    int i,j;
    int N[100000];
    int Q[50000];
    int count=0;
    int right,left,mid;
    int key;
    
    /* scan N[] */
    scanf("%d",&n);
    if(n>=100001)return 0;
    
    for(i=0;i<n;i++){
        scanf("%d",&N[i]);
    }
    /* -------- */
    
    /* scan Q[] */
    scanf("%d",&q);
    if(q>=50001)return 0;
    
    for(i=0;i<q;i++){
        scanf("%d",&Q[i]);
    }
    /* --------- */
    
    
    for(i=0;i<q;i++) {
        key=Q[i];
        left=0;
        right=n;
        
        while(left < right){
            mid = (right+left)/2;
            if(key == N[mid]){count++;break;}
            if(key > N[mid])left=mid+1;
            else if(key<N[mid])right=mid;
        }
        
    }
    printf("%d\n",count);
    return 0;
}