import java.util.Scanner;

public class Main {

	
	public static boolean exist(int[] list, int number, int start, int end) {
	
		int l = end - start;
		int midIndex = start + l/2;
		
		if(start == end) {
			return list[start] == number;
		}
		else if(list[midIndex] == number) {
			return true;
		}
		else if(list[midIndex] > number) {
			return exist(list,number,start,midIndex);
		}
		else {
			return exist(list, number, midIndex+1, end);
		}
		
				
	}
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String arraySizeS = sc.nextLine();
		int arraySize = Integer.parseInt(arraySizeS);
		String[] inputArrayS = sc.nextLine().split(" ");
		int[] inputArray = new int[arraySize];
		for( int i = 0; i < arraySize; i += 1) {
			inputArray[i] = Integer.parseInt(inputArrayS[i]);}
		String arraySizeS2 = sc.nextLine();
		int arraySize2 = Integer.parseInt(arraySizeS2);
		String[] inputArrayS2 = sc.nextLine().split(" ");
		int[] inputArray2 = new int[arraySize2];
		for( int j = 0; j < arraySize2; j += 1) {
			inputArray2[j] = Integer.parseInt(inputArrayS2[j]);	
		}
		
		int counter = 0;
		
		for(int m = 0; m < inputArray2.length; m += 1) {
			if (exist(inputArray,inputArray2[m],0,inputArray.length-1)) {
				counter += 1;
			}
		}
		System.out.println(counter);
			
	}

} import java.util.Scanner; Scanner java.util public class Main {

	
	public static boolean exist(int[] list, int number, int start, int end) {
	
		int l = end - start;
		int midIndex = start + l/2;
		
		if(start == end) {
			return list[start] == number;
		}
		else if(list[midIndex] == number) {
			return true;
		}
		else if(list[midIndex] > number) {
			return exist(list,number,start,midIndex);
		}
		else {
			return exist(list, number, midIndex+1, end);
		}
		
				
	}
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String arraySizeS = sc.nextLine();
		int arraySize = Integer.parseInt(arraySizeS);
		String[] inputArrayS = sc.nextLine().split(" ");
		int[] inputArray = new int[arraySize];
		for( int i = 0; i < arraySize; i += 1) {
			inputArray[i] = Integer.parseInt(inputArrayS[i]);}
		String arraySizeS2 = sc.nextLine();
		int arraySize2 = Integer.parseInt(arraySizeS2);
		String[] inputArrayS2 = sc.nextLine().split(" ");
		int[] inputArray2 = new int[arraySize2];
		for( int j = 0; j < arraySize2; j += 1) {
			inputArray2[j] = Integer.parseInt(inputArrayS2[j]);	
		}
		
		int counter = 0;
		
		for(int m = 0; m < inputArray2.length; m += 1) {
			if (exist(inputArray,inputArray2[m],0,inputArray.length-1)) {
				counter += 1;
			}
		}
		System.out.println(counter);
			
	}

} Main public static boolean exist(int[] list, int number, int start, int end) {
	
		int l = end - start;
		int midIndex = start + l/2;
		
		if(start == end) {
			return list[start] == number;
		}
		else if(list[midIndex] == number) {
			return true;
		}
		else if(list[midIndex] > number) {
			return exist(list,number,start,midIndex);
		}
		else {
			return exist(list, number, midIndex+1, end);
		}
		
				
	} exist {
	
		int l = end - start;
		int midIndex = start + l/2;
		
		if(start == end) {
			return list[start] == number;
		}
		else if(list[midIndex] == number) {
			return true;
		}
		else if(list[midIndex] > number) {
			return exist(list,number,start,midIndex);
		}
		else {
			return exist(list, number, midIndex+1, end);
		}
		
				
	} int l = end - start; l end - start end start int midIndex = start + l/2; midIndex start + l/2 start l/2 l 2 if(start == end) {
			return list[start] == number;
		}
		else if(list[midIndex] == number) {
			return true;
		}
		else if(list[midIndex] > number) {
			return exist(list,number,start,midIndex);
		}
		else {
			return exist(list, number, midIndex+1, end);
		} start == end start end {
			return list[start] == number;
		} return list[start] == number; list[start] == number list[start] list start number if(list[midIndex] == number) {
			return true;
		}
		else if(list[midIndex] > number) {
			return exist(list,number,start,midIndex);
		}
		else {
			return exist(list, number, midIndex+1, end);
		} list[midIndex] == number list[midIndex] list midIndex number {
			return true;
		} return true; true if(list[midIndex] > number) {
			return exist(list,number,start,midIndex);
		}
		else {
			return exist(list, number, midIndex+1, end);
		} list[midIndex] > number list[midIndex] list midIndex number {
			return exist(list,number,start,midIndex);
		} return exist(list,number,start,midIndex); exist(list,number,start,midIndex) exist list number start midIndex {
			return exist(list, number, midIndex+1, end);
		} return exist(list, number, midIndex+1, end); exist(list, number, midIndex+1, end) exist list number midIndex+1 midIndex 1 end int[] list list int number number int start start int end end public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String arraySizeS = sc.nextLine();
		int arraySize = Integer.parseInt(arraySizeS);
		String[] inputArrayS = sc.nextLine().split(" ");
		int[] inputArray = new int[arraySize];
		for( int i = 0; i < arraySize; i += 1) {
			inputArray[i] = Integer.parseInt(inputArrayS[i]);}
		String arraySizeS2 = sc.nextLine();
		int arraySize2 = Integer.parseInt(arraySizeS2);
		String[] inputArrayS2 = sc.nextLine().split(" ");
		int[] inputArray2 = new int[arraySize2];
		for( int j = 0; j < arraySize2; j += 1) {
			inputArray2[j] = Integer.parseInt(inputArrayS2[j]);	
		}
		
		int counter = 0;
		
		for(int m = 0; m < inputArray2.length; m += 1) {
			if (exist(inputArray,inputArray2[m],0,inputArray.length-1)) {
				counter += 1;
			}
		}
		System.out.println(counter);
			
	} main {
		Scanner sc = new Scanner(System.in);
		String arraySizeS = sc.nextLine();
		int arraySize = Integer.parseInt(arraySizeS);
		String[] inputArrayS = sc.nextLine().split(" ");
		int[] inputArray = new int[arraySize];
		for( int i = 0; i < arraySize; i += 1) {
			inputArray[i] = Integer.parseInt(inputArrayS[i]);}
		String arraySizeS2 = sc.nextLine();
		int arraySize2 = Integer.parseInt(arraySizeS2);
		String[] inputArrayS2 = sc.nextLine().split(" ");
		int[] inputArray2 = new int[arraySize2];
		for( int j = 0; j < arraySize2; j += 1) {
			inputArray2[j] = Integer.parseInt(inputArrayS2[j]);	
		}
		
		int counter = 0;
		
		for(int m = 0; m < inputArray2.length; m += 1) {
			if (exist(inputArray,inputArray2[m],0,inputArray.length-1)) {
				counter += 1;
			}
		}
		System.out.println(counter);
			
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String arraySizeS = sc.nextLine(); arraySizeS sc.nextLine() sc.nextLine sc int arraySize = Integer.parseInt(arraySizeS); arraySize Integer.parseInt(arraySizeS) Integer.parseInt Integer arraySizeS String[] inputArrayS = sc.nextLine().split(" "); inputArrayS sc.nextLine().split(" ") sc.nextLine().split sc.nextLine() sc.nextLine sc " " int[] inputArray = new int[arraySize]; inputArray new int[arraySize] arraySize for( int i = 0; i < arraySize; i += 1) {
			inputArray[i] = Integer.parseInt(inputArrayS[i]);} int i = 0; int i = 0; i 0 i < arraySize i arraySize i += 1 i += 1 i 1 {
			inputArray[i] = Integer.parseInt(inputArrayS[i]);} {
			inputArray[i] = Integer.parseInt(inputArrayS[i]);} inputArray[i] = Integer.parseInt(inputArrayS[i]) inputArray[i] inputArray i Integer.parseInt(inputArrayS[i]) Integer.parseInt Integer inputArrayS[i] inputArrayS i String arraySizeS2 = sc.nextLine(); arraySizeS2 sc.nextLine() sc.nextLine sc int arraySize2 = Integer.parseInt(arraySizeS2); arraySize2 Integer.parseInt(arraySizeS2) Integer.parseInt Integer arraySizeS2 String[] inputArrayS2 = sc.nextLine().split(" "); inputArrayS2 sc.nextLine().split(" ") sc.nextLine().split sc.nextLine() sc.nextLine sc " " int[] inputArray2 = new int[arraySize2]; inputArray2 new int[arraySize2] arraySize2 for( int j = 0; j < arraySize2; j += 1) {
			inputArray2[j] = Integer.parseInt(inputArrayS2[j]);	
		} int j = 0; int j = 0; j 0 j < arraySize2 j arraySize2 j += 1 j += 1 j 1 {
			inputArray2[j] = Integer.parseInt(inputArrayS2[j]);	
		} {
			inputArray2[j] = Integer.parseInt(inputArrayS2[j]);	
		} inputArray2[j] = Integer.parseInt(inputArrayS2[j]) inputArray2[j] inputArray2 j Integer.parseInt(inputArrayS2[j]) Integer.parseInt Integer inputArrayS2[j] inputArrayS2 j int counter = 0; counter 0 for(int m = 0; m < inputArray2.length; m += 1) {
			if (exist(inputArray,inputArray2[m],0,inputArray.length-1)) {
				counter += 1;
			}
		} int m = 0; int m = 0; m 0 m < inputArray2.length m inputArray2.length inputArray2 inputArray2.length m += 1 m += 1 m 1 {
			if (exist(inputArray,inputArray2[m],0,inputArray.length-1)) {
				counter += 1;
			}
		} {
			if (exist(inputArray,inputArray2[m],0,inputArray.length-1)) {
				counter += 1;
			}
		} if (exist(inputArray,inputArray2[m],0,inputArray.length-1)) {
				counter += 1;
			} exist(inputArray,inputArray2[m],0,inputArray.length-1) exist inputArray inputArray2[m] inputArray2 m 0 inputArray.length-1 inputArray.length inputArray inputArray.length 1 {
				counter += 1;
			} counter += 1 counter 1 System.out.println(counter) System.out.println System.out System System.out counter String[] args args public class Main {

	
	public static boolean exist(int[] list, int number, int start, int end) {
	
		int l = end - start;
		int midIndex = start + l/2;
		
		if(start == end) {
			return list[start] == number;
		}
		else if(list[midIndex] == number) {
			return true;
		}
		else if(list[midIndex] > number) {
			return exist(list,number,start,midIndex);
		}
		else {
			return exist(list, number, midIndex+1, end);
		}
		
				
	}
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String arraySizeS = sc.nextLine();
		int arraySize = Integer.parseInt(arraySizeS);
		String[] inputArrayS = sc.nextLine().split(" ");
		int[] inputArray = new int[arraySize];
		for( int i = 0; i < arraySize; i += 1) {
			inputArray[i] = Integer.parseInt(inputArrayS[i]);}
		String arraySizeS2 = sc.nextLine();
		int arraySize2 = Integer.parseInt(arraySizeS2);
		String[] inputArrayS2 = sc.nextLine().split(" ");
		int[] inputArray2 = new int[arraySize2];
		for( int j = 0; j < arraySize2; j += 1) {
			inputArray2[j] = Integer.parseInt(inputArrayS2[j]);	
		}
		
		int counter = 0;
		
		for(int m = 0; m < inputArray2.length; m += 1) {
			if (exist(inputArray,inputArray2[m],0,inputArray.length-1)) {
				counter += 1;
			}
		}
		System.out.println(counter);
			
	}

} public class Main {

	
	public static boolean exist(int[] list, int number, int start, int end) {
	
		int l = end - start;
		int midIndex = start + l/2;
		
		if(start == end) {
			return list[start] == number;
		}
		else if(list[midIndex] == number) {
			return true;
		}
		else if(list[midIndex] > number) {
			return exist(list,number,start,midIndex);
		}
		else {
			return exist(list, number, midIndex+1, end);
		}
		
				
	}
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String arraySizeS = sc.nextLine();
		int arraySize = Integer.parseInt(arraySizeS);
		String[] inputArrayS = sc.nextLine().split(" ");
		int[] inputArray = new int[arraySize];
		for( int i = 0; i < arraySize; i += 1) {
			inputArray[i] = Integer.parseInt(inputArrayS[i]);}
		String arraySizeS2 = sc.nextLine();
		int arraySize2 = Integer.parseInt(arraySizeS2);
		String[] inputArrayS2 = sc.nextLine().split(" ");
		int[] inputArray2 = new int[arraySize2];
		for( int j = 0; j < arraySize2; j += 1) {
			inputArray2[j] = Integer.parseInt(inputArrayS2[j]);	
		}
		
		int counter = 0;
		
		for(int m = 0; m < inputArray2.length; m += 1) {
			if (exist(inputArray,inputArray2[m],0,inputArray.length-1)) {
				counter += 1;
			}
		}
		System.out.println(counter);
			
	}

} Main
import java.util.Scanner;

public class Main {

	
	public static boolean exist(int[] list, int number, int start, int end) {
	
		int l = end - start;
		int midIndex = start + l/2;
		
		if(start == end) {
			return list[start] == number;
		}
		else if(list[midIndex] == number) {
			return true;
		}
		else if(list[midIndex] > number) {
			return exist(list,number,start,midIndex);
		}
		else {
			return exist(list, number, midIndex+1, end);
		}
		
				
	}
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String arraySizeS = sc.nextLine();
		int arraySize = Integer.parseInt(arraySizeS);
		String[] inputArrayS = sc.nextLine().split(" ");
		int[] inputArray = new int[arraySize];
		for( int i = 0; i < arraySize; i += 1) {
			inputArray[i] = Integer.parseInt(inputArrayS[i]);}
		String arraySizeS2 = sc.nextLine();
		int arraySize2 = Integer.parseInt(arraySizeS2);
		String[] inputArrayS2 = sc.nextLine().split(" ");
		int[] inputArray2 = new int[arraySize2];
		for( int j = 0; j < arraySize2; j += 1) {
			inputArray2[j] = Integer.parseInt(inputArrayS2[j]);	
		}
		
		int counter = 0;
		
		for(int m = 0; m < inputArray2.length; m += 1) {
			if (exist(inputArray,inputArray2[m],0,inputArray.length-1)) {
				counter += 1;
			}
		}
		System.out.println(counter);
			
	}

}
