import java.util.Scanner;

public class Main {

    static Scanner scan;
    static int count = 0;

    public static void main(String[] args) {
        scan = new Scanner(System.in);

         // get input
         final int slen = scan.nextInt();
         int[] s = new int[slen];
         for(int i = 0; i < slen; i++) {
             s[i] = scan.nextInt();
         }

         final int tlen = scan.nextInt();
         int[] t = new int[tlen];
         for(int i = 0; i < tlen; i++){
             t[i] = scan.nextInt();
         }

         // carry out binary search
         for(int i = 0; i < tlen; i++) {
             binarySearch(s, t[i]);
         }

         System.out.println(count);
    }

    public static void binarySearch(int[] s, int t){
        int hi = 0; int ti = s.length-1; //先頭のインデックス; 末尾のインデックス;
        int p;

        while(hi <= ti) {
            p = (hi + ti) / 2; //探索対象インデックス
            if(s[p] == t) {
                count++;
                break;
            } else if(s[p] < t) {
                hi = p + 1;
                continue;
            } else {
                ti = p - 1;
                continue;
            }
        }

        return;
    }
}


/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