import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int[] sArray = new int[n];
		for (int i = 0; i < n; i++) {
			sArray[i] = scanner.nextInt();
		}
		int p = scanner.nextInt();
		int[] tArray = new int[p];
		int cnt = 0;
		for (int i = 0; i < p; i++) {
			tArray[i] = scanner.nextInt();
			if(binarySearch(sArray, tArray[i], 0, n-1)){
				cnt++;
			}
		}
		System.out.println(cnt);
	}
	
	public static boolean binarySearch(int[] sArray, int tElement, int start,
			int end) {

		if (tElement == sArray[(start + end) / 2]) {
			return true;
		} else if (start == end) {
			return false;
		} else {
			if (tElement < sArray[(start + end) / 2]) {
				return binarySearch(sArray, tElement, start,
						(start + end) / 2);
			} else {
				return binarySearch(sArray, tElement, (start + end) / 2+1, end);
			}
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int[] sArray = new int[n];
		for (int i = 0; i < n; i++) {
			sArray[i] = scanner.nextInt();
		}
		int p = scanner.nextInt();
		int[] tArray = new int[p];
		int cnt = 0;
		for (int i = 0; i < p; i++) {
			tArray[i] = scanner.nextInt();
			if(binarySearch(sArray, tArray[i], 0, n-1)){
				cnt++;
			}
		}
		System.out.println(cnt);
	}
	
	public static boolean binarySearch(int[] sArray, int tElement, int start,
			int end) {

		if (tElement == sArray[(start + end) / 2]) {
			return true;
		} else if (start == end) {
			return false;
		} else {
			if (tElement < sArray[(start + end) / 2]) {
				return binarySearch(sArray, tElement, start,
						(start + end) / 2);
			} else {
				return binarySearch(sArray, tElement, (start + end) / 2+1, end);
			}
		}
	}
} Main public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int[] sArray = new int[n];
		for (int i = 0; i < n; i++) {
			sArray[i] = scanner.nextInt();
		}
		int p = scanner.nextInt();
		int[] tArray = new int[p];
		int cnt = 0;
		for (int i = 0; i < p; i++) {
			tArray[i] = scanner.nextInt();
			if(binarySearch(sArray, tArray[i], 0, n-1)){
				cnt++;
			}
		}
		System.out.println(cnt);
	} main {

		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int[] sArray = new int[n];
		for (int i = 0; i < n; i++) {
			sArray[i] = scanner.nextInt();
		}
		int p = scanner.nextInt();
		int[] tArray = new int[p];
		int cnt = 0;
		for (int i = 0; i < p; i++) {
			tArray[i] = scanner.nextInt();
			if(binarySearch(sArray, tArray[i], 0, n-1)){
				cnt++;
			}
		}
		System.out.println(cnt);
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int n = scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner int[] sArray = new int[n]; sArray new int[n] n for (int i = 0; i < n; i++) {
			sArray[i] = scanner.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			sArray[i] = scanner.nextInt();
		} {
			sArray[i] = scanner.nextInt();
		} sArray[i] = scanner.nextInt() sArray[i] sArray i scanner.nextInt() scanner.nextInt scanner int p = scanner.nextInt(); p scanner.nextInt() scanner.nextInt scanner int[] tArray = new int[p]; tArray new int[p] p int cnt = 0; cnt 0 for (int i = 0; i < p; i++) {
			tArray[i] = scanner.nextInt();
			if(binarySearch(sArray, tArray[i], 0, n-1)){
				cnt++;
			}
		} int i = 0; int i = 0; i 0 i < p i p i++ i++ i {
			tArray[i] = scanner.nextInt();
			if(binarySearch(sArray, tArray[i], 0, n-1)){
				cnt++;
			}
		} {
			tArray[i] = scanner.nextInt();
			if(binarySearch(sArray, tArray[i], 0, n-1)){
				cnt++;
			}
		} tArray[i] = scanner.nextInt() tArray[i] tArray i scanner.nextInt() scanner.nextInt scanner if(binarySearch(sArray, tArray[i], 0, n-1)){
				cnt++;
			} binarySearch(sArray, tArray[i], 0, n-1) binarySearch sArray tArray[i] tArray i 0 n-1 n 1 {
				cnt++;
			} cnt++ cnt System.out.println(cnt) System.out.println System.out System System.out cnt String[] args args public static boolean binarySearch(int[] sArray, int tElement, int start,
			int end) {

		if (tElement == sArray[(start + end) / 2]) {
			return true;
		} else if (start == end) {
			return false;
		} else {
			if (tElement < sArray[(start + end) / 2]) {
				return binarySearch(sArray, tElement, start,
						(start + end) / 2);
			} else {
				return binarySearch(sArray, tElement, (start + end) / 2+1, end);
			}
		}
	} binarySearch {

		if (tElement == sArray[(start + end) / 2]) {
			return true;
		} else if (start == end) {
			return false;
		} else {
			if (tElement < sArray[(start + end) / 2]) {
				return binarySearch(sArray, tElement, start,
						(start + end) / 2);
			} else {
				return binarySearch(sArray, tElement, (start + end) / 2+1, end);
			}
		}
	} if (tElement == sArray[(start + end) / 2]) {
			return true;
		} else if (start == end) {
			return false;
		} else {
			if (tElement < sArray[(start + end) / 2]) {
				return binarySearch(sArray, tElement, start,
						(start + end) / 2);
			} else {
				return binarySearch(sArray, tElement, (start + end) / 2+1, end);
			}
		} tElement == sArray[(start + end) / 2] tElement sArray[(start + end) / 2] sArray (start + end) / 2 (start + end) start end 2 {
			return true;
		} return true; true if (start == end) {
			return false;
		} else {
			if (tElement < sArray[(start + end) / 2]) {
				return binarySearch(sArray, tElement, start,
						(start + end) / 2);
			} else {
				return binarySearch(sArray, tElement, (start + end) / 2+1, end);
			}
		} start == end start end {
			return false;
		} return false; false {
			if (tElement < sArray[(start + end) / 2]) {
				return binarySearch(sArray, tElement, start,
						(start + end) / 2);
			} else {
				return binarySearch(sArray, tElement, (start + end) / 2+1, end);
			}
		} if (tElement < sArray[(start + end) / 2]) {
				return binarySearch(sArray, tElement, start,
						(start + end) / 2);
			} else {
				return binarySearch(sArray, tElement, (start + end) / 2+1, end);
			} tElement < sArray[(start + end) / 2] tElement sArray[(start + end) / 2] sArray (start + end) / 2 (start + end) start end 2 {
				return binarySearch(sArray, tElement, start,
						(start + end) / 2);
			} return binarySearch(sArray, tElement, start,
						(start + end) / 2); binarySearch(sArray, tElement, start,
						(start + end) / 2) binarySearch sArray tElement start (start + end) / 2 (start + end) start end 2 {
				return binarySearch(sArray, tElement, (start + end) / 2+1, end);
			} return binarySearch(sArray, tElement, (start + end) / 2+1, end); binarySearch(sArray, tElement, (start + end) / 2+1, end) binarySearch sArray tElement (start + end) / 2+1 (start + end) / 2 (start + end) start end 2 1 end int[] sArray sArray int tElement tElement int start start int end end public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int[] sArray = new int[n];
		for (int i = 0; i < n; i++) {
			sArray[i] = scanner.nextInt();
		}
		int p = scanner.nextInt();
		int[] tArray = new int[p];
		int cnt = 0;
		for (int i = 0; i < p; i++) {
			tArray[i] = scanner.nextInt();
			if(binarySearch(sArray, tArray[i], 0, n-1)){
				cnt++;
			}
		}
		System.out.println(cnt);
	}
	
	public static boolean binarySearch(int[] sArray, int tElement, int start,
			int end) {

		if (tElement == sArray[(start + end) / 2]) {
			return true;
		} else if (start == end) {
			return false;
		} else {
			if (tElement < sArray[(start + end) / 2]) {
				return binarySearch(sArray, tElement, start,
						(start + end) / 2);
			} else {
				return binarySearch(sArray, tElement, (start + end) / 2+1, end);
			}
		}
	}
} public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int[] sArray = new int[n];
		for (int i = 0; i < n; i++) {
			sArray[i] = scanner.nextInt();
		}
		int p = scanner.nextInt();
		int[] tArray = new int[p];
		int cnt = 0;
		for (int i = 0; i < p; i++) {
			tArray[i] = scanner.nextInt();
			if(binarySearch(sArray, tArray[i], 0, n-1)){
				cnt++;
			}
		}
		System.out.println(cnt);
	}
	
	public static boolean binarySearch(int[] sArray, int tElement, int start,
			int end) {

		if (tElement == sArray[(start + end) / 2]) {
			return true;
		} else if (start == end) {
			return false;
		} else {
			if (tElement < sArray[(start + end) / 2]) {
				return binarySearch(sArray, tElement, start,
						(start + end) / 2);
			} else {
				return binarySearch(sArray, tElement, (start + end) / 2+1, end);
			}
		}
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int[] sArray = new int[n];
		for (int i = 0; i < n; i++) {
			sArray[i] = scanner.nextInt();
		}
		int p = scanner.nextInt();
		int[] tArray = new int[p];
		int cnt = 0;
		for (int i = 0; i < p; i++) {
			tArray[i] = scanner.nextInt();
			if(binarySearch(sArray, tArray[i], 0, n-1)){
				cnt++;
			}
		}
		System.out.println(cnt);
	}
	
	public static boolean binarySearch(int[] sArray, int tElement, int start,
			int end) {

		if (tElement == sArray[(start + end) / 2]) {
			return true;
		} else if (start == end) {
			return false;
		} else {
			if (tElement < sArray[(start + end) / 2]) {
				return binarySearch(sArray, tElement, start,
						(start + end) / 2);
			} else {
				return binarySearch(sArray, tElement, (start + end) / 2+1, end);
			}
		}
	}
}