import java.io.*;
import java.util.*;


class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int count = 0;
	int R = sc.nextInt();
	int[] A = new int[R];
	for(int i = 0;i < R;i++){
	    A[i] = sc.nextInt();
	}
	int N = sc.nextInt();
	int[] B = new int[N];
	for(int j = 0;j < N;j++){
	    B[j] = sc.nextInt();
	}
	for(int j = 0;j < N;j++){
	    if(binarySearch(A,B[j])){
		count++;
	    }
	}
	System.out.println(count);
    }
 //     public static boolean linearSearch(int[] A,int key){
//     	int i = 0;
//     	for(i = 0;i < A.length;i++){
//     	    if(A[i] == key){
//     		return true;
//     	    }
//     	}
//     	return false;
//     }
// }
    public static boolean binarySearch(int[] A,int key){
    	int left = 0;
    	int right = A.length;
    	int mid = 0;
    	while(left < right){
    	    mid = (left + right) / 2;
	 
    	    if(A[mid] == key){
    		return true;
    	    }else if(key < A[mid]){
    		right = mid;
    	    }else{
    		left = mid + 1;
    	    }
    	}
    	return false;
    }
}
 import java.io.*; io.* java import java.util.*; util.* java class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int count = 0;
	int R = sc.nextInt();
	int[] A = new int[R];
	for(int i = 0;i < R;i++){
	    A[i] = sc.nextInt();
	}
	int N = sc.nextInt();
	int[] B = new int[N];
	for(int j = 0;j < N;j++){
	    B[j] = sc.nextInt();
	}
	for(int j = 0;j < N;j++){
	    if(binarySearch(A,B[j])){
		count++;
	    }
	}
	System.out.println(count);
    }
 //     public static boolean linearSearch(int[] A,int key){
//     	int i = 0;
//     	for(i = 0;i < A.length;i++){
//     	    if(A[i] == key){
//     		return true;
//     	    }
//     	}
//     	return false;
//     }
// }
    public static boolean binarySearch(int[] A,int key){
    	int left = 0;
    	int right = A.length;
    	int mid = 0;
    	while(left < right){
    	    mid = (left + right) / 2;
	 
    	    if(A[mid] == key){
    		return true;
    	    }else if(key < A[mid]){
    		right = mid;
    	    }else{
    		left = mid + 1;
    	    }
    	}
    	return false;
    }
} Main public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int count = 0;
	int R = sc.nextInt();
	int[] A = new int[R];
	for(int i = 0;i < R;i++){
	    A[i] = sc.nextInt();
	}
	int N = sc.nextInt();
	int[] B = new int[N];
	for(int j = 0;j < N;j++){
	    B[j] = sc.nextInt();
	}
	for(int j = 0;j < N;j++){
	    if(binarySearch(A,B[j])){
		count++;
	    }
	}
	System.out.println(count);
    } main {
	Scanner sc = new Scanner(System.in);
	int count = 0;
	int R = sc.nextInt();
	int[] A = new int[R];
	for(int i = 0;i < R;i++){
	    A[i] = sc.nextInt();
	}
	int N = sc.nextInt();
	int[] B = new int[N];
	for(int j = 0;j < N;j++){
	    B[j] = sc.nextInt();
	}
	for(int j = 0;j < N;j++){
	    if(binarySearch(A,B[j])){
		count++;
	    }
	}
	System.out.println(count);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int count = 0; count 0 int R = sc.nextInt(); R sc.nextInt() sc.nextInt sc int[] A = new int[R]; A new int[R] R for(int i = 0;i < R;i++){
	    A[i] = sc.nextInt();
	} int i = 0; int i = 0; i 0 i < R i R i++ i++ i {
	    A[i] = sc.nextInt();
	} {
	    A[i] = sc.nextInt();
	} A[i] = sc.nextInt() A[i] A i sc.nextInt() sc.nextInt sc int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int[] B = new int[N]; B new int[N] N for(int j = 0;j < N;j++){
	    B[j] = sc.nextInt();
	} int j = 0; int j = 0; j 0 j < N j N j++ j++ j {
	    B[j] = sc.nextInt();
	} {
	    B[j] = sc.nextInt();
	} B[j] = sc.nextInt() B[j] B j sc.nextInt() sc.nextInt sc for(int j = 0;j < N;j++){
	    if(binarySearch(A,B[j])){
		count++;
	    }
	} int j = 0; int j = 0; j 0 j < N j N j++ j++ j {
	    if(binarySearch(A,B[j])){
		count++;
	    }
	} {
	    if(binarySearch(A,B[j])){
		count++;
	    }
	} if(binarySearch(A,B[j])){
		count++;
	    } binarySearch(A,B[j]) binarySearch A B[j] B j {
		count++;
	    } count++ count System.out.println(count) System.out.println System.out System System.out count String[] args args //     public static boolean linearSearch(int[] A,int key){
//     	int i = 0;
//     	for(i = 0;i < A.length;i++){
//     	    if(A[i] == key){
//     		return true;
//     	    }
//     	}
//     	return false;
//     }
// }
    public static boolean binarySearch(int[] A,int key){
    	int left = 0;
    	int right = A.length;
    	int mid = 0;
    	while(left < right){
    	    mid = (left + right) / 2;
	 
    	    if(A[mid] == key){
    		return true;
    	    }else if(key < A[mid]){
    		right = mid;
    	    }else{
    		left = mid + 1;
    	    }
    	}
    	return false;
    } binarySearch {
    	int left = 0;
    	int right = A.length;
    	int mid = 0;
    	while(left < right){
    	    mid = (left + right) / 2;
	 
    	    if(A[mid] == key){
    		return true;
    	    }else if(key < A[mid]){
    		right = mid;
    	    }else{
    		left = mid + 1;
    	    }
    	}
    	return false;
    } int left = 0; left 0 int right = A.length; right A.length A A.length int mid = 0; mid 0 while(left < right){
    	    mid = (left + right) / 2;
	 
    	    if(A[mid] == key){
    		return true;
    	    }else if(key < A[mid]){
    		right = mid;
    	    }else{
    		left = mid + 1;
    	    }
    	} left < right left right {
    	    mid = (left + right) / 2;
	 
    	    if(A[mid] == key){
    		return true;
    	    }else if(key < A[mid]){
    		right = mid;
    	    }else{
    		left = mid + 1;
    	    }
    	} mid = (left + right) / 2 mid (left + right) / 2 (left + right) left right 2 if(A[mid] == key){
    		return true;
    	    }else if(key < A[mid]){
    		right = mid;
    	    }else{
    		left = mid + 1;
    	    } A[mid] == key A[mid] A mid key {
    		return true;
    	    } return true; true if(key < A[mid]){
    		right = mid;
    	    }else{
    		left = mid + 1;
    	    } key < A[mid] key A[mid] A mid {
    		right = mid;
    	    } right = mid right mid {
    		left = mid + 1;
    	    } left = mid + 1 left mid + 1 mid 1 return false; false int[] A A int key key
import java.io.*;
import java.util.*;


class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int count = 0;
	int R = sc.nextInt();
	int[] A = new int[R];
	for(int i = 0;i < R;i++){
	    A[i] = sc.nextInt();
	}
	int N = sc.nextInt();
	int[] B = new int[N];
	for(int j = 0;j < N;j++){
	    B[j] = sc.nextInt();
	}
	for(int j = 0;j < N;j++){
	    if(binarySearch(A,B[j])){
		count++;
	    }
	}
	System.out.println(count);
    }
 //     public static boolean linearSearch(int[] A,int key){
//     	int i = 0;
//     	for(i = 0;i < A.length;i++){
//     	    if(A[i] == key){
//     		return true;
//     	    }
//     	}
//     	return false;
//     }
// }
    public static boolean binarySearch(int[] A,int key){
    	int left = 0;
    	int right = A.length;
    	int mid = 0;
    	while(left < right){
    	    mid = (left + right) / 2;
	 
    	    if(A[mid] == key){
    		return true;
    	    }else if(key < A[mid]){
    		right = mid;
    	    }else{
    		left = mid + 1;
    	    }
    	}
    	return false;
    }
}

