import java.util.Scanner;

/**
 * Created by zhangrunfeng on 2/17/20
 */

public class Main {
    private int N;
    private int[] increArr;

    private int Q;
    private int[] arrQ;

    public Main (Scanner sc) {
        N = sc.nextInt();
        increArr = new int[N];
        for (int i = 0; i < N; i++) {
            increArr[i] = sc.nextInt();
        }

        Q = sc.nextInt();
        arrQ = new int[Q];
        for (int i = 0; i < Q; i++) {
            arrQ[i] = sc.nextInt();
        }
    }

    private boolean binarySearch(int targetVal) {
        int leftIx = 0, rightIdx = N-1;
        while (leftIx <= rightIdx) {
            int midIx = leftIx + (rightIdx - leftIx) / 2;
            if (increArr[midIx] == targetVal) {
                return true;
            } else if (increArr[midIx] > targetVal) {
                rightIdx = midIx - 1;
            } else {
                leftIx = midIx + 1;
            }
        }
        return false;
    }

    public int countQinN() {
        int count = 0;
        for (int targetVal : arrQ) {
            if (binarySearch(targetVal)) {
                count++;
            }
        }
        return count;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        int res = m.countQinN();
        System.out.println(res);
    }
}

/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