import java.util.Scanner;public class Main {	public static void main(String[] args) {		int n, sum = 0;		Scanner sc = new Scanner(System.in);		n = sc.nextInt();		int[] S = new int[100001];		for (int i = 0; i < n; i++) {			S[i] = sc.nextInt();		}		int q, key = 0;		q = sc.nextInt();		for (int i = 0; i < q; i++) {			key = sc.nextInt();			if (binarySearch(S, n, key))				sum++;		}		System.out.println(sum);	}	private static boolean binarySearch(int[] S, int n, int key) {		int left = 0;		int right = n - 1;		while (left <= right) {			int mid = (left + right) / 2;			if (key == S[mid])				return true;			else if (key > S[mid])				left = mid + 1;			else				right = mid - 1;		}		return false;	}} import java.util.Scanner; Scanner java.util public class Main {	public static void main(String[] args) {		int n, sum = 0;		Scanner sc = new Scanner(System.in);		n = sc.nextInt();		int[] S = new int[100001];		for (int i = 0; i < n; i++) {			S[i] = sc.nextInt();		}		int q, key = 0;		q = sc.nextInt();		for (int i = 0; i < q; i++) {			key = sc.nextInt();			if (binarySearch(S, n, key))				sum++;		}		System.out.println(sum);	}	private static boolean binarySearch(int[] S, int n, int key) {		int left = 0;		int right = n - 1;		while (left <= right) {			int mid = (left + right) / 2;			if (key == S[mid])				return true;			else if (key > S[mid])				left = mid + 1;			else				right = mid - 1;		}		return false;	}} Main public static void main(String[] args) {		int n, sum = 0;		Scanner sc = new Scanner(System.in);		n = sc.nextInt();		int[] S = new int[100001];		for (int i = 0; i < n; i++) {			S[i] = sc.nextInt();		}		int q, key = 0;		q = sc.nextInt();		for (int i = 0; i < q; i++) {			key = sc.nextInt();			if (binarySearch(S, n, key))				sum++;		}		System.out.println(sum);	} main {		int n, sum = 0;		Scanner sc = new Scanner(System.in);		n = sc.nextInt();		int[] S = new int[100001];		for (int i = 0; i < n; i++) {			S[i] = sc.nextInt();		}		int q, key = 0;		q = sc.nextInt();		for (int i = 0; i < q; i++) {			key = sc.nextInt();			if (binarySearch(S, n, key))				sum++;		}		System.out.println(sum);	} int n n sum = 0; sum 0 Scanner sc = new Scanner(System.in); sc new Scanner(System.in) n = sc.nextInt() n sc.nextInt() sc.nextInt sc int[] S = new int[100001]; S new int[100001] 100001 for (int i = 0; i < n; i++) {			S[i] = sc.nextInt();		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {			S[i] = sc.nextInt();		} {			S[i] = sc.nextInt();		} S[i] = sc.nextInt() S[i] S i sc.nextInt() sc.nextInt sc int q q key = 0; key 0 q = sc.nextInt() q sc.nextInt() sc.nextInt sc for (int i = 0; i < q; i++) {			key = sc.nextInt();			if (binarySearch(S, n, key))				sum++;		} int i = 0; int i = 0; i 0 i < q i q i++ i++ i {			key = sc.nextInt();			if (binarySearch(S, n, key))				sum++;		} {			key = sc.nextInt();			if (binarySearch(S, n, key))				sum++;		} key = sc.nextInt() key sc.nextInt() sc.nextInt sc if (binarySearch(S, n, key))				sum++; binarySearch(S, n, key) binarySearch S n key sum++ sum System.out.println(sum) System.out.println System.out System System.out sum String[] args args private static boolean binarySearch(int[] S, int n, int key) {		int left = 0;		int right = n - 1;		while (left <= right) {			int mid = (left + right) / 2;			if (key == S[mid])				return true;			else if (key > S[mid])				left = mid + 1;			else				right = mid - 1;		}		return false;	} binarySearch {		int left = 0;		int right = n - 1;		while (left <= right) {			int mid = (left + right) / 2;			if (key == S[mid])				return true;			else if (key > S[mid])				left = mid + 1;			else				right = mid - 1;		}		return false;	} int left = 0; left 0 int right = n - 1; right n - 1 n 1 while (left <= right) {			int mid = (left + right) / 2;			if (key == S[mid])				return true;			else if (key > S[mid])				left = mid + 1;			else				right = mid - 1;		} left <= right left right {			int mid = (left + right) / 2;			if (key == S[mid])				return true;			else if (key > S[mid])				left = mid + 1;			else				right = mid - 1;		} int mid = (left + right) / 2; mid (left + right) / 2 (left + right) left right 2 if (key == S[mid])				return true;			else if (key > S[mid])				left = mid + 1;			else				right = mid - 1; key == S[mid] key S[mid] S mid return true; true if (key > S[mid])				left = mid + 1;			else				right = mid - 1; key > S[mid] key S[mid] S mid left = mid + 1 left mid + 1 mid 1 right = mid - 1 right mid - 1 mid 1 return false; false int[] S S int n n int key key public class Main {	public static void main(String[] args) {		int n, sum = 0;		Scanner sc = new Scanner(System.in);		n = sc.nextInt();		int[] S = new int[100001];		for (int i = 0; i < n; i++) {			S[i] = sc.nextInt();		}		int q, key = 0;		q = sc.nextInt();		for (int i = 0; i < q; i++) {			key = sc.nextInt();			if (binarySearch(S, n, key))				sum++;		}		System.out.println(sum);	}	private static boolean binarySearch(int[] S, int n, int key) {		int left = 0;		int right = n - 1;		while (left <= right) {			int mid = (left + right) / 2;			if (key == S[mid])				return true;			else if (key > S[mid])				left = mid + 1;			else				right = mid - 1;		}		return false;	}} public class Main {	public static void main(String[] args) {		int n, sum = 0;		Scanner sc = new Scanner(System.in);		n = sc.nextInt();		int[] S = new int[100001];		for (int i = 0; i < n; i++) {			S[i] = sc.nextInt();		}		int q, key = 0;		q = sc.nextInt();		for (int i = 0; i < q; i++) {			key = sc.nextInt();			if (binarySearch(S, n, key))				sum++;		}		System.out.println(sum);	}	private static boolean binarySearch(int[] S, int n, int key) {		int left = 0;		int right = n - 1;		while (left <= right) {			int mid = (left + right) / 2;			if (key == S[mid])				return true;			else if (key > S[mid])				left = mid + 1;			else				right = mid - 1;		}		return false;	}} Main
import java.util.Scanner;public class Main {	public static void main(String[] args) {		int n, sum = 0;		Scanner sc = new Scanner(System.in);		n = sc.nextInt();		int[] S = new int[100001];		for (int i = 0; i < n; i++) {			S[i] = sc.nextInt();		}		int q, key = 0;		q = sc.nextInt();		for (int i = 0; i < q; i++) {			key = sc.nextInt();			if (binarySearch(S, n, key))				sum++;		}		System.out.println(sum);	}	private static boolean binarySearch(int[] S, int n, int key) {		int left = 0;		int right = n - 1;		while (left <= right) {			int mid = (left + right) / 2;			if (key == S[mid])				return true;			else if (key > S[mid])				left = mid + 1;			else				right = mid - 1;		}		return false;	}}
