import java.util.Scanner;

public class Main {
	
	public static Boolean BinarySearch(int[] Value, int input, int left, int right) {
		int middle = left + (right-left)/2;  // 
		if (right < left) {
			return false;  // This means that the algorithm is not sorted
			}
		else if (Value[middle] > input) {
			return BinarySearch(Value,input,left,middle-1);  
			}
		else if (Value[middle] < input) {
			return BinarySearch(Value,input,middle+1,right); 
			}
		else {  
			return true;
			}
	}
	
	public static int contains(int[] Value, int[] Array) {
		int sum = 0;
		int left = 0;
		int right = Value.length - 1;
		for (int elements : Array) {
			if (BinarySearch(Value, elements, left, right)) {  // iterates through each value in T and searches for it in S
				sum++;
			}
		}
		return sum;
	}

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int array1 = in.nextInt();
		int[] Value = new int[array1];
		for (int i = 0; i < array1; i++) {
			int number = in.nextInt();
			Value[i] = number;
		}
		int array2 = in.nextInt();
		int[] Array = new int[array2];
		for (int i = 0; i < array2; i++) {
			int number = in.nextInt();
			Array[i] = number;
		}
		in.close();
		int value = contains(Value,Array);
		System.out.println(value);
	}

} import java.util.Scanner; Scanner java.util public class Main {
	
	public static Boolean BinarySearch(int[] Value, int input, int left, int right) {
		int middle = left + (right-left)/2;  // 
		if (right < left) {
			return false;  // This means that the algorithm is not sorted
			}
		else if (Value[middle] > input) {
			return BinarySearch(Value,input,left,middle-1);  
			}
		else if (Value[middle] < input) {
			return BinarySearch(Value,input,middle+1,right); 
			}
		else {  
			return true;
			}
	}
	
	public static int contains(int[] Value, int[] Array) {
		int sum = 0;
		int left = 0;
		int right = Value.length - 1;
		for (int elements : Array) {
			if (BinarySearch(Value, elements, left, right)) {  // iterates through each value in T and searches for it in S
				sum++;
			}
		}
		return sum;
	}

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int array1 = in.nextInt();
		int[] Value = new int[array1];
		for (int i = 0; i < array1; i++) {
			int number = in.nextInt();
			Value[i] = number;
		}
		int array2 = in.nextInt();
		int[] Array = new int[array2];
		for (int i = 0; i < array2; i++) {
			int number = in.nextInt();
			Array[i] = number;
		}
		in.close();
		int value = contains(Value,Array);
		System.out.println(value);
	}

} Main public static Boolean BinarySearch(int[] Value, int input, int left, int right) {
		int middle = left + (right-left)/2;  // 
		if (right < left) {
			return false;  // This means that the algorithm is not sorted
			}
		else if (Value[middle] > input) {
			return BinarySearch(Value,input,left,middle-1);  
			}
		else if (Value[middle] < input) {
			return BinarySearch(Value,input,middle+1,right); 
			}
		else {  
			return true;
			}
	} BinarySearch {
		int middle = left + (right-left)/2;  // 
		if (right < left) {
			return false;  // This means that the algorithm is not sorted
			}
		else if (Value[middle] > input) {
			return BinarySearch(Value,input,left,middle-1);  
			}
		else if (Value[middle] < input) {
			return BinarySearch(Value,input,middle+1,right); 
			}
		else {  
			return true;
			}
	} int middle = left + (right-left)/2; middle left + (right-left)/2 left (right-left)/2 (right-left) right left 2 if (right < left) {
			return false;  // This means that the algorithm is not sorted
			}
		else if (Value[middle] > input) {
			return BinarySearch(Value,input,left,middle-1);  
			}
		else if (Value[middle] < input) {
			return BinarySearch(Value,input,middle+1,right); 
			}
		else {  
			return true;
			} right < left right left {
			return false;  // This means that the algorithm is not sorted
			} return false;  // This means that the algorithm is not sorted false if (Value[middle] > input) {
			return BinarySearch(Value,input,left,middle-1);  
			}
		else if (Value[middle] < input) {
			return BinarySearch(Value,input,middle+1,right); 
			}
		else {  
			return true;
			} Value[middle] > input Value[middle] Value middle input {
			return BinarySearch(Value,input,left,middle-1);  
			} return BinarySearch(Value,input,left,middle-1); BinarySearch(Value,input,left,middle-1) BinarySearch Value input left middle-1 middle 1 if (Value[middle] < input) {
			return BinarySearch(Value,input,middle+1,right); 
			}
		else {  
			return true;
			} Value[middle] < input Value[middle] Value middle input {
			return BinarySearch(Value,input,middle+1,right); 
			} return BinarySearch(Value,input,middle+1,right); BinarySearch(Value,input,middle+1,right) BinarySearch Value input middle+1 middle 1 right {  
			return true;
			} return true; true int[] Value Value int input input int left left int right right public static int contains(int[] Value, int[] Array) {
		int sum = 0;
		int left = 0;
		int right = Value.length - 1;
		for (int elements : Array) {
			if (BinarySearch(Value, elements, left, right)) {  // iterates through each value in T and searches for it in S
				sum++;
			}
		}
		return sum;
	} contains {
		int sum = 0;
		int left = 0;
		int right = Value.length - 1;
		for (int elements : Array) {
			if (BinarySearch(Value, elements, left, right)) {  // iterates through each value in T and searches for it in S
				sum++;
			}
		}
		return sum;
	} int sum = 0; sum 0 int left = 0; left 0 int right = Value.length - 1; right Value.length - 1 Value.length Value Value.length 1 for (int elements : Array) {
			if (BinarySearch(Value, elements, left, right)) {  // iterates through each value in T and searches for it in S
				sum++;
			}
		} int elements Array {
			if (BinarySearch(Value, elements, left, right)) {  // iterates through each value in T and searches for it in S
				sum++;
			}
		} {
			if (BinarySearch(Value, elements, left, right)) {  // iterates through each value in T and searches for it in S
				sum++;
			}
		} if (BinarySearch(Value, elements, left, right)) {  // iterates through each value in T and searches for it in S
				sum++;
			} BinarySearch(Value, elements, left, right) BinarySearch Value elements left right {  // iterates through each value in T and searches for it in S
				sum++;
			} sum++ sum return sum; sum int[] Value Value int[] Array Array public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int array1 = in.nextInt();
		int[] Value = new int[array1];
		for (int i = 0; i < array1; i++) {
			int number = in.nextInt();
			Value[i] = number;
		}
		int array2 = in.nextInt();
		int[] Array = new int[array2];
		for (int i = 0; i < array2; i++) {
			int number = in.nextInt();
			Array[i] = number;
		}
		in.close();
		int value = contains(Value,Array);
		System.out.println(value);
	} main {
		Scanner in = new Scanner(System.in);
		int array1 = in.nextInt();
		int[] Value = new int[array1];
		for (int i = 0; i < array1; i++) {
			int number = in.nextInt();
			Value[i] = number;
		}
		int array2 = in.nextInt();
		int[] Array = new int[array2];
		for (int i = 0; i < array2; i++) {
			int number = in.nextInt();
			Array[i] = number;
		}
		in.close();
		int value = contains(Value,Array);
		System.out.println(value);
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) int array1 = in.nextInt(); array1 in.nextInt() in.nextInt in int[] Value = new int[array1]; Value new int[array1] array1 for (int i = 0; i < array1; i++) {
			int number = in.nextInt();
			Value[i] = number;
		} int i = 0; int i = 0; i 0 i < array1 i array1 i++ i++ i {
			int number = in.nextInt();
			Value[i] = number;
		} {
			int number = in.nextInt();
			Value[i] = number;
		} int number = in.nextInt(); number in.nextInt() in.nextInt in Value[i] = number Value[i] Value i number int array2 = in.nextInt(); array2 in.nextInt() in.nextInt in int[] Array = new int[array2]; Array new int[array2] array2 for (int i = 0; i < array2; i++) {
			int number = in.nextInt();
			Array[i] = number;
		} int i = 0; int i = 0; i 0 i < array2 i array2 i++ i++ i {
			int number = in.nextInt();
			Array[i] = number;
		} {
			int number = in.nextInt();
			Array[i] = number;
		} int number = in.nextInt(); number in.nextInt() in.nextInt in Array[i] = number Array[i] Array i number in.close() in.close in int value = contains(Value,Array); value contains(Value,Array) contains Value Array System.out.println(value) System.out.println System.out System System.out value String[] args args public class Main {
	
	public static Boolean BinarySearch(int[] Value, int input, int left, int right) {
		int middle = left + (right-left)/2;  // 
		if (right < left) {
			return false;  // This means that the algorithm is not sorted
			}
		else if (Value[middle] > input) {
			return BinarySearch(Value,input,left,middle-1);  
			}
		else if (Value[middle] < input) {
			return BinarySearch(Value,input,middle+1,right); 
			}
		else {  
			return true;
			}
	}
	
	public static int contains(int[] Value, int[] Array) {
		int sum = 0;
		int left = 0;
		int right = Value.length - 1;
		for (int elements : Array) {
			if (BinarySearch(Value, elements, left, right)) {  // iterates through each value in T and searches for it in S
				sum++;
			}
		}
		return sum;
	}

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int array1 = in.nextInt();
		int[] Value = new int[array1];
		for (int i = 0; i < array1; i++) {
			int number = in.nextInt();
			Value[i] = number;
		}
		int array2 = in.nextInt();
		int[] Array = new int[array2];
		for (int i = 0; i < array2; i++) {
			int number = in.nextInt();
			Array[i] = number;
		}
		in.close();
		int value = contains(Value,Array);
		System.out.println(value);
	}

} public class Main {
	
	public static Boolean BinarySearch(int[] Value, int input, int left, int right) {
		int middle = left + (right-left)/2;  // 
		if (right < left) {
			return false;  // This means that the algorithm is not sorted
			}
		else if (Value[middle] > input) {
			return BinarySearch(Value,input,left,middle-1);  
			}
		else if (Value[middle] < input) {
			return BinarySearch(Value,input,middle+1,right); 
			}
		else {  
			return true;
			}
	}
	
	public static int contains(int[] Value, int[] Array) {
		int sum = 0;
		int left = 0;
		int right = Value.length - 1;
		for (int elements : Array) {
			if (BinarySearch(Value, elements, left, right)) {  // iterates through each value in T and searches for it in S
				sum++;
			}
		}
		return sum;
	}

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int array1 = in.nextInt();
		int[] Value = new int[array1];
		for (int i = 0; i < array1; i++) {
			int number = in.nextInt();
			Value[i] = number;
		}
		int array2 = in.nextInt();
		int[] Array = new int[array2];
		for (int i = 0; i < array2; i++) {
			int number = in.nextInt();
			Array[i] = number;
		}
		in.close();
		int value = contains(Value,Array);
		System.out.println(value);
	}

} Main
import java.util.Scanner;

public class Main {
	
	public static Boolean BinarySearch(int[] Value, int input, int left, int right) {
		int middle = left + (right-left)/2;  // 
		if (right < left) {
			return false;  // This means that the algorithm is not sorted
			}
		else if (Value[middle] > input) {
			return BinarySearch(Value,input,left,middle-1);  
			}
		else if (Value[middle] < input) {
			return BinarySearch(Value,input,middle+1,right); 
			}
		else {  
			return true;
			}
	}
	
	public static int contains(int[] Value, int[] Array) {
		int sum = 0;
		int left = 0;
		int right = Value.length - 1;
		for (int elements : Array) {
			if (BinarySearch(Value, elements, left, right)) {  // iterates through each value in T and searches for it in S
				sum++;
			}
		}
		return sum;
	}

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int array1 = in.nextInt();
		int[] Value = new int[array1];
		for (int i = 0; i < array1; i++) {
			int number = in.nextInt();
			Value[i] = number;
		}
		int array2 = in.nextInt();
		int[] Array = new int[array2];
		for (int i = 0; i < array2; i++) {
			int number = in.nextInt();
			Array[i] = number;
		}
		in.close();
		int value = contains(Value,Array);
		System.out.println(value);
	}

}
