import java.io.IOException;
import java.io.InputStreamReader;
import java.io.BufferedReader;

class Main {

    static boolean binarySearch(int[] a, int key, int begin, int end){     
        if(begin >= end){
            if(a[begin] != key){
                return false;
            }
        }

        int med = (begin + end) / 2;
        if (a[med] == key) {
            return true;
        } else if (a[med] > key) {
            return binarySearch(a, key, begin, med - 1);
        } else if (a[med] < key) {
            return binarySearch(a, key, med + 1, end);
        }

        return false; // unreachable
    }

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        int result = 0;

        int n = Integer.parseInt(br.readLine());
        int[] S = new int[n];
        String[] inputs = br.readLine().split(" ");
        for (int i = 0; i < n; i++) {
            S[i] = Integer.parseInt(inputs[i]);
        }

        int q = Integer.parseInt(br.readLine());
        String[] inputt = br.readLine().split(" ");
        for (String str : inputt) {
            if (binarySearch(S, Integer.parseInt(str), 0, n - 1)) {
                result++;
            }
        }

        System.out.println(result);
    }
}

/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