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

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