#include<stdio.h>
#include<stdlib.h>

int linearSearch(int a[],int N,int key){
    int i;
    a[N] = key;
    for(i=0;i<N+1;i++){
        if(a[i]==key)break;
    }
    return i == N ? -1:i;
}

int main(void){
    int i,ns,nt;
    int *S,*T;
    /*?????????????????????*/
    scanf("%d",&ns);
    S = malloc(sizeof(int)*(ns+1));//??????????????????1?????????????¢????
    for(i=0;i<ns;i++)
        scanf("%d",&S[i]);
    scanf("%d",&nt);
    T = malloc(sizeof(int)*nt);
    for(i=0;i<nt;i++)
        scanf("%d",&T[i]);
    /*?????????????????????*/
    
    
    int count = 0;
    for(i=0;i<nt;i++){
        if(linearSearch(S,ns,T[i])!=-1)count++;
    }
    printf("%d\n",count);
    
    return 0;
}