import java.util.Scanner;
class Main {
    public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] S = new int[n]; 
		
		for(int i = 0; i < n; i++){
			S[i] = scan.nextInt();
		}
		
		int q = scan.nextInt();
		int[] T = new int[q];
		
		for(int i = 0; i < q; i++){
			T[i] = scan.nextInt();
		}
		
		int result = 0;
		for(int i = 0; i < T.length; i++){
			result += BinarySearch(S, T[i]);
		}
		
		System.out.println(result);
	}

	static int BinarySearch(int data[], int serch){
		
		int min = 0;
		int max = data.length - 1;
		
		while(min <= max){
			
			int middle = (min + max) / 2;
			if(serch == data[middle]){
				return 1;
			}else if(serch < data[middle]){
				max = middle - 1;
			}else{
				min = middle + 1;
			}
		}
		return 0;
	}
} import java.util.Scanner; Scanner java.util class Main {
    public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] S = new int[n]; 
		
		for(int i = 0; i < n; i++){
			S[i] = scan.nextInt();
		}
		
		int q = scan.nextInt();
		int[] T = new int[q];
		
		for(int i = 0; i < q; i++){
			T[i] = scan.nextInt();
		}
		
		int result = 0;
		for(int i = 0; i < T.length; i++){
			result += BinarySearch(S, T[i]);
		}
		
		System.out.println(result);
	}

	static int BinarySearch(int data[], int serch){
		
		int min = 0;
		int max = data.length - 1;
		
		while(min <= max){
			
			int middle = (min + max) / 2;
			if(serch == data[middle]){
				return 1;
			}else if(serch < data[middle]){
				max = middle - 1;
			}else{
				min = middle + 1;
			}
		}
		return 0;
	}
} Main public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] S = new int[n]; 
		
		for(int i = 0; i < n; i++){
			S[i] = scan.nextInt();
		}
		
		int q = scan.nextInt();
		int[] T = new int[q];
		
		for(int i = 0; i < q; i++){
			T[i] = scan.nextInt();
		}
		
		int result = 0;
		for(int i = 0; i < T.length; i++){
			result += BinarySearch(S, T[i]);
		}
		
		System.out.println(result);
	} main {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] S = new int[n]; 
		
		for(int i = 0; i < n; i++){
			S[i] = scan.nextInt();
		}
		
		int q = scan.nextInt();
		int[] T = new int[q];
		
		for(int i = 0; i < q; i++){
			T[i] = scan.nextInt();
		}
		
		int result = 0;
		for(int i = 0; i < T.length; i++){
			result += BinarySearch(S, T[i]);
		}
		
		System.out.println(result);
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int[] S = new int[n]; S new int[n] n for(int i = 0; i < n; i++){
			S[i] = scan.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			S[i] = scan.nextInt();
		} {
			S[i] = scan.nextInt();
		} S[i] = scan.nextInt() S[i] S i scan.nextInt() scan.nextInt scan int q = scan.nextInt(); q scan.nextInt() scan.nextInt scan int[] T = new int[q]; T new int[q] q for(int i = 0; i < q; i++){
			T[i] = scan.nextInt();
		} int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
			T[i] = scan.nextInt();
		} {
			T[i] = scan.nextInt();
		} T[i] = scan.nextInt() T[i] T i scan.nextInt() scan.nextInt scan int result = 0; result 0 for(int i = 0; i < T.length; i++){
			result += BinarySearch(S, T[i]);
		} int i = 0; int i = 0; i 0 i < T.length i T.length T T.length i++ i++ i {
			result += BinarySearch(S, T[i]);
		} {
			result += BinarySearch(S, T[i]);
		} result += BinarySearch(S, T[i]) result BinarySearch(S, T[i]) BinarySearch S T[i] T i System.out.println(result) System.out.println System.out System System.out result String[] args args static int BinarySearch(int data[], int serch){
		
		int min = 0;
		int max = data.length - 1;
		
		while(min <= max){
			
			int middle = (min + max) / 2;
			if(serch == data[middle]){
				return 1;
			}else if(serch < data[middle]){
				max = middle - 1;
			}else{
				min = middle + 1;
			}
		}
		return 0;
	} BinarySearch {
		
		int min = 0;
		int max = data.length - 1;
		
		while(min <= max){
			
			int middle = (min + max) / 2;
			if(serch == data[middle]){
				return 1;
			}else if(serch < data[middle]){
				max = middle - 1;
			}else{
				min = middle + 1;
			}
		}
		return 0;
	} int min = 0; min 0 int max = data.length - 1; max data.length - 1 data.length data data.length 1 while(min <= max){
			
			int middle = (min + max) / 2;
			if(serch == data[middle]){
				return 1;
			}else if(serch < data[middle]){
				max = middle - 1;
			}else{
				min = middle + 1;
			}
		} min <= max min max {
			
			int middle = (min + max) / 2;
			if(serch == data[middle]){
				return 1;
			}else if(serch < data[middle]){
				max = middle - 1;
			}else{
				min = middle + 1;
			}
		} int middle = (min + max) / 2; middle (min + max) / 2 (min + max) min max 2 if(serch == data[middle]){
				return 1;
			}else if(serch < data[middle]){
				max = middle - 1;
			}else{
				min = middle + 1;
			} serch == data[middle] serch data[middle] data middle {
				return 1;
			} return 1; 1 if(serch < data[middle]){
				max = middle - 1;
			}else{
				min = middle + 1;
			} serch < data[middle] serch data[middle] data middle {
				max = middle - 1;
			} max = middle - 1 max middle - 1 middle 1 {
				min = middle + 1;
			} min = middle + 1 min middle + 1 middle 1 return 0; 0 int data[] data int serch serch
import java.util.Scanner;
class Main {
    public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] S = new int[n]; 
		
		for(int i = 0; i < n; i++){
			S[i] = scan.nextInt();
		}
		
		int q = scan.nextInt();
		int[] T = new int[q];
		
		for(int i = 0; i < q; i++){
			T[i] = scan.nextInt();
		}
		
		int result = 0;
		for(int i = 0; i < T.length; i++){
			result += BinarySearch(S, T[i]);
		}
		
		System.out.println(result);
	}

	static int BinarySearch(int data[], int serch){
		
		int min = 0;
		int max = data.length - 1;
		
		while(min <= max){
			
			int middle = (min + max) / 2;
			if(serch == data[middle]){
				return 1;
			}else if(serch < data[middle]){
				max = middle - 1;
			}else{
				min = middle + 1;
			}
		}
		return 0;
	}
}