#include<stdio.h>
#include<math.h>
int main(void) {
    int n, i, j, left, right, mid, s[100000], q, t[50000], count = 0;
    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]);
        left = 0;
        right = n - 1;
        while ( left < right ) {
            mid = (left + right) / 2;
            if ( t[i] == s[mid] ) {count++; break;}
            else if ( t[i] < s[mid] ) right = mid;
            else left = mid++;
            printf("left%d right%d t[%d]%d s[%d]%d\n", left, right, i, t[i], mid, s[mid]);
        }
    }
    printf("%d\n", count);
    return 0;
}