import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int num1 = scan.nextInt();
		int[] array1 = new int[num1+1];
		 //配列1個目
		for(int i = 0; i < num1; i++) {
			array1[i] = scan.nextInt();
		}
		//配列2個目
		int num2 = scan.nextInt();
		int[] array2 = new int[num2];
		for(int i = 0; i < num2; i++) {
			array2[i] = scan.nextInt();
		}
		
		int count = 0; //2つの配列の共通の個数
		
		for(int i = 0; i < num2; i++) {
		count += binarySearch(num1, array1, array2[i]);
		}
		
		System.out.println(count);
}
	
	public static int binarySearch(int n, int[] A, int key) {
		int left = 0;
		int right = n;
		int mid;
		while(left < right) {
			mid = (left + right) / 2;
			if(A[mid] == key) {
				return 1;
			} else if(key < A[mid]) {
					right = mid;
				} else {
					left = mid + 1;
			}
		}
		return 0;
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int num1 = scan.nextInt();
		int[] array1 = new int[num1+1];
		 //配列1個目
		for(int i = 0; i < num1; i++) {
			array1[i] = scan.nextInt();
		}
		//配列2個目
		int num2 = scan.nextInt();
		int[] array2 = new int[num2];
		for(int i = 0; i < num2; i++) {
			array2[i] = scan.nextInt();
		}
		
		int count = 0; //2つの配列の共通の個数
		
		for(int i = 0; i < num2; i++) {
		count += binarySearch(num1, array1, array2[i]);
		}
		
		System.out.println(count);
}
	
	public static int binarySearch(int n, int[] A, int key) {
		int left = 0;
		int right = n;
		int mid;
		while(left < right) {
			mid = (left + right) / 2;
			if(A[mid] == key) {
				return 1;
			} else if(key < A[mid]) {
					right = mid;
				} else {
					left = mid + 1;
			}
		}
		return 0;
	}
} Main public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int num1 = scan.nextInt();
		int[] array1 = new int[num1+1];
		 //配列1個目
		for(int i = 0; i < num1; i++) {
			array1[i] = scan.nextInt();
		}
		//配列2個目
		int num2 = scan.nextInt();
		int[] array2 = new int[num2];
		for(int i = 0; i < num2; i++) {
			array2[i] = scan.nextInt();
		}
		
		int count = 0; //2つの配列の共通の個数
		
		for(int i = 0; i < num2; i++) {
		count += binarySearch(num1, array1, array2[i]);
		}
		
		System.out.println(count);
} main {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int num1 = scan.nextInt();
		int[] array1 = new int[num1+1];
		 //配列1個目
		for(int i = 0; i < num1; i++) {
			array1[i] = scan.nextInt();
		}
		//配列2個目
		int num2 = scan.nextInt();
		int[] array2 = new int[num2];
		for(int i = 0; i < num2; i++) {
			array2[i] = scan.nextInt();
		}
		
		int count = 0; //2つの配列の共通の個数
		
		for(int i = 0; i < num2; i++) {
		count += binarySearch(num1, array1, array2[i]);
		}
		
		System.out.println(count);
} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int num1 = scan.nextInt(); num1 scan.nextInt() scan.nextInt scan int[] array1 = new int[num1+1]; array1 new int[num1+1] num1+1 num1 1 for(int i = 0; i < num1; i++) {
			array1[i] = scan.nextInt();
		} int i = 0; int i = 0; i 0 i < num1 i num1 i++ i++ i {
			array1[i] = scan.nextInt();
		} {
			array1[i] = scan.nextInt();
		} array1[i] = scan.nextInt() array1[i] array1 i scan.nextInt() scan.nextInt scan int num2 = scan.nextInt(); num2 scan.nextInt() scan.nextInt scan int[] array2 = new int[num2]; array2 new int[num2] num2 for(int i = 0; i < num2; i++) {
			array2[i] = scan.nextInt();
		} int i = 0; int i = 0; i 0 i < num2 i num2 i++ i++ i {
			array2[i] = scan.nextInt();
		} {
			array2[i] = scan.nextInt();
		} array2[i] = scan.nextInt() array2[i] array2 i scan.nextInt() scan.nextInt scan int count = 0; count 0 for(int i = 0; i < num2; i++) {
		count += binarySearch(num1, array1, array2[i]);
		} int i = 0; int i = 0; i 0 i < num2 i num2 i++ i++ i {
		count += binarySearch(num1, array1, array2[i]);
		} {
		count += binarySearch(num1, array1, array2[i]);
		} count += binarySearch(num1, array1, array2[i]) count binarySearch(num1, array1, array2[i]) binarySearch num1 array1 array2[i] array2 i System.out.println(count) System.out.println System.out System System.out count String[] args args public static int binarySearch(int n, int[] A, int key) {
		int left = 0;
		int right = n;
		int mid;
		while(left < right) {
			mid = (left + right) / 2;
			if(A[mid] == key) {
				return 1;
			} else if(key < A[mid]) {
					right = mid;
				} else {
					left = mid + 1;
			}
		}
		return 0;
	} binarySearch {
		int left = 0;
		int right = n;
		int mid;
		while(left < right) {
			mid = (left + right) / 2;
			if(A[mid] == key) {
				return 1;
			} else if(key < A[mid]) {
					right = mid;
				} else {
					left = mid + 1;
			}
		}
		return 0;
	} int left = 0; left 0 int right = n; right n int mid; mid while(left < right) {
			mid = (left + right) / 2;
			if(A[mid] == key) {
				return 1;
			} else if(key < A[mid]) {
					right = mid;
				} else {
					left = mid + 1;
			}
		} left < right left right {
			mid = (left + right) / 2;
			if(A[mid] == key) {
				return 1;
			} 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 1;
			} else if(key < A[mid]) {
					right = mid;
				} else {
					left = mid + 1;
			} A[mid] == key A[mid] A mid key {
				return 1;
			} return 1; 1 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 0; 0 int n n int[] A A int key key public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int num1 = scan.nextInt();
		int[] array1 = new int[num1+1];
		 //配列1個目
		for(int i = 0; i < num1; i++) {
			array1[i] = scan.nextInt();
		}
		//配列2個目
		int num2 = scan.nextInt();
		int[] array2 = new int[num2];
		for(int i = 0; i < num2; i++) {
			array2[i] = scan.nextInt();
		}
		
		int count = 0; //2つの配列の共通の個数
		
		for(int i = 0; i < num2; i++) {
		count += binarySearch(num1, array1, array2[i]);
		}
		
		System.out.println(count);
}
	
	public static int binarySearch(int n, int[] A, int key) {
		int left = 0;
		int right = n;
		int mid;
		while(left < right) {
			mid = (left + right) / 2;
			if(A[mid] == key) {
				return 1;
			} else if(key < A[mid]) {
					right = mid;
				} else {
					left = mid + 1;
			}
		}
		return 0;
	}
} public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int num1 = scan.nextInt();
		int[] array1 = new int[num1+1];
		 //配列1個目
		for(int i = 0; i < num1; i++) {
			array1[i] = scan.nextInt();
		}
		//配列2個目
		int num2 = scan.nextInt();
		int[] array2 = new int[num2];
		for(int i = 0; i < num2; i++) {
			array2[i] = scan.nextInt();
		}
		
		int count = 0; //2つの配列の共通の個数
		
		for(int i = 0; i < num2; i++) {
		count += binarySearch(num1, array1, array2[i]);
		}
		
		System.out.println(count);
}
	
	public static int binarySearch(int n, int[] A, int key) {
		int left = 0;
		int right = n;
		int mid;
		while(left < right) {
			mid = (left + right) / 2;
			if(A[mid] == key) {
				return 1;
			} else if(key < A[mid]) {
					right = mid;
				} else {
					left = mid + 1;
			}
		}
		return 0;
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int num1 = scan.nextInt();
		int[] array1 = new int[num1+1];
		 //配列1個目
		for(int i = 0; i < num1; i++) {
			array1[i] = scan.nextInt();
		}
		//配列2個目
		int num2 = scan.nextInt();
		int[] array2 = new int[num2];
		for(int i = 0; i < num2; i++) {
			array2[i] = scan.nextInt();
		}
		
		int count = 0; //2つの配列の共通の個数
		
		for(int i = 0; i < num2; i++) {
		count += binarySearch(num1, array1, array2[i]);
		}
		
		System.out.println(count);
}
	
	public static int binarySearch(int n, int[] A, int key) {
		int left = 0;
		int right = n;
		int mid;
		while(left < right) {
			mid = (left + right) / 2;
			if(A[mid] == key) {
				return 1;
			} else if(key < A[mid]) {
					right = mid;
				} else {
					left = mid + 1;
			}
		}
		return 0;
	}
}
