import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		int C = 0;
		Scanner in = new Scanner(System.in);
		//??°???S?????????
		int n = in.nextInt();
		int[] S = new int[n];
		for(int i = 0;i<n;i++) S[i] = in.nextInt();
		//??°???T?????????
		int q = in.nextInt();
		int[] T = new int[q];
		for(int i = 0;i<q;i++) T[i] = in.nextInt();
		
	
		for(int i = 0;i<q;i++){
			int searchkey = T[i];
			int lowerBound = 0;
			int upperBound = n-1;
			int curIn;
			while(true){
				curIn = (lowerBound+upperBound)/2;
				if(S[curIn] == searchkey) {
					C++;
					break;
				}else if(lowerBound>upperBound) break;
				else{
					if(S[curIn]<searchkey)
						lowerBound = curIn +1;
					else
						upperBound = curIn -1;
				}
				
			}
		}
		System.out.println(C);
	}
}
/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