#include<stdio.h>

int BSort(int t, int *S, int n){
    int high, mid, low;
    high = n;
    low = 0;
    while(low <= high){
        mid = (high + low) / 2;
        if(S[mid] == t) return 1;
        else if(S[mid] < t) low = mid + 1;
        else high = mid;
    }
    return 0;
}
 
int main(){
    int i, j, cnt=0;
    int n, q;
    int S[10000], T[500];
    int high, mid, low;
    int b_mid;
 
    scanf("%d", &n);
    for(i=0;i<n;i++) scanf("%d", &S[i]);
    scanf("%d", &q);
    for(i=0;i<q;i++) scanf("%d", &T[i]);
    
    for(i=0;i<q;i++){
        cnt += BSort(T[i], S, n);
    }
    
    printf("%d\n", cnt);
 
    return 0;
}