#include <stdio.h>

int S[10001], n, q;

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

        return -1;
    */

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


}

int main()
{
    int result = 0, key;
    scanf("%d", &n);
    for(int i = 0; i < n; i++) {
        scanf("%d", &S[i]);
    }

    scanf("%d",&q);
    for(int i = 0; i < q; i++) {
        scanf("%d", &key);
        if(binarySearch(key)) result++;
    }
    printf("%d\n", result);
    return 0;
}