import java.util.Scanner;

public class Main {
    public static int search(int l, int r,int[] S, int target){
        int mid = (l+r)/2;
        if(mid == l || mid == r){
            return -1;
        }
        else if(S[r] < target || S[l] > target){
            return -1;
        }
        else if(S[mid] == target){
            return 1;
        }
        else if(S[r] == target){
            return 1;
        }
        else if(S[l] == target){
            return 1;
        }
        else if(S[mid] < target){
            return search(mid, r, S, target);
        }
        else{
            return search(l, mid, S, target);
        }
    }
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int S[];
        int T[];
        int n = sc.nextInt();
        S = new int[n];
        for(int i = 0; i < n; i ++){
            S[i] = sc.nextInt();
        }
        int q = sc.nextInt();
        T = new int[q];
        for(int i = 0; i < q; i++){
            T[i] = sc.nextInt();
        }
        int num = 0;
        for(int i = 0; i < q; i++){
            if(search(0, n-1, S, T[i]) == 1){
                num++;
            }
        }
        System.out.println(num);
    }
}

/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz