
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		new Main().run();
	}

	private void run() {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int[] num = new int[n];
		for (int i = 0; i < n; i++) {
			num[i] = scanner.nextInt();
		}
		int m = scanner.nextInt();
		int count = 0;
		while (m-- > 0) {
			int a = scanner.nextInt();
			int l = 0;
			int r = n - 1;
			while (l <= r) {
				int mid = (l + r) / 2;
				if (num[mid] > a) {
					r = mid - 1;
				} else if (num[mid] < a) {
					l = mid + 1;
				} else {
					count++;
					break;
				}
			}
		}
		System.out.println(count);
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		new Main().run();
	}

	private void run() {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int[] num = new int[n];
		for (int i = 0; i < n; i++) {
			num[i] = scanner.nextInt();
		}
		int m = scanner.nextInt();
		int count = 0;
		while (m-- > 0) {
			int a = scanner.nextInt();
			int l = 0;
			int r = n - 1;
			while (l <= r) {
				int mid = (l + r) / 2;
				if (num[mid] > a) {
					r = mid - 1;
				} else if (num[mid] < a) {
					l = mid + 1;
				} else {
					count++;
					break;
				}
			}
		}
		System.out.println(count);
	}
} Main public static void main(String[] args) {
		new Main().run();
	} main {
		new Main().run();
	} new Main().run() new Main().run new Main() String[] args args private void run() {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int[] num = new int[n];
		for (int i = 0; i < n; i++) {
			num[i] = scanner.nextInt();
		}
		int m = scanner.nextInt();
		int count = 0;
		while (m-- > 0) {
			int a = scanner.nextInt();
			int l = 0;
			int r = n - 1;
			while (l <= r) {
				int mid = (l + r) / 2;
				if (num[mid] > a) {
					r = mid - 1;
				} else if (num[mid] < a) {
					l = mid + 1;
				} else {
					count++;
					break;
				}
			}
		}
		System.out.println(count);
	} run {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int[] num = new int[n];
		for (int i = 0; i < n; i++) {
			num[i] = scanner.nextInt();
		}
		int m = scanner.nextInt();
		int count = 0;
		while (m-- > 0) {
			int a = scanner.nextInt();
			int l = 0;
			int r = n - 1;
			while (l <= r) {
				int mid = (l + r) / 2;
				if (num[mid] > a) {
					r = mid - 1;
				} else if (num[mid] < a) {
					l = mid + 1;
				} else {
					count++;
					break;
				}
			}
		}
		System.out.println(count);
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int n = scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner int[] num = new int[n]; num new int[n] n for (int i = 0; i < n; i++) {
			num[i] = scanner.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			num[i] = scanner.nextInt();
		} {
			num[i] = scanner.nextInt();
		} num[i] = scanner.nextInt() num[i] num i scanner.nextInt() scanner.nextInt scanner int m = scanner.nextInt(); m scanner.nextInt() scanner.nextInt scanner int count = 0; count 0 while (m-- > 0) {
			int a = scanner.nextInt();
			int l = 0;
			int r = n - 1;
			while (l <= r) {
				int mid = (l + r) / 2;
				if (num[mid] > a) {
					r = mid - 1;
				} else if (num[mid] < a) {
					l = mid + 1;
				} else {
					count++;
					break;
				}
			}
		} m-- > 0 m-- m 0 {
			int a = scanner.nextInt();
			int l = 0;
			int r = n - 1;
			while (l <= r) {
				int mid = (l + r) / 2;
				if (num[mid] > a) {
					r = mid - 1;
				} else if (num[mid] < a) {
					l = mid + 1;
				} else {
					count++;
					break;
				}
			}
		} int a = scanner.nextInt(); a scanner.nextInt() scanner.nextInt scanner int l = 0; l 0 int r = n - 1; r n - 1 n 1 while (l <= r) {
				int mid = (l + r) / 2;
				if (num[mid] > a) {
					r = mid - 1;
				} else if (num[mid] < a) {
					l = mid + 1;
				} else {
					count++;
					break;
				}
			} l <= r l r {
				int mid = (l + r) / 2;
				if (num[mid] > a) {
					r = mid - 1;
				} else if (num[mid] < a) {
					l = mid + 1;
				} else {
					count++;
					break;
				}
			} int mid = (l + r) / 2; mid (l + r) / 2 (l + r) l r 2 if (num[mid] > a) {
					r = mid - 1;
				} else if (num[mid] < a) {
					l = mid + 1;
				} else {
					count++;
					break;
				} num[mid] > a num[mid] num mid a {
					r = mid - 1;
				} r = mid - 1 r mid - 1 mid 1 if (num[mid] < a) {
					l = mid + 1;
				} else {
					count++;
					break;
				} num[mid] < a num[mid] num mid a {
					l = mid + 1;
				} l = mid + 1 l mid + 1 mid 1 {
					count++;
					break;
				} count++ count break; System.out.println(count) System.out.println System.out System System.out count public class Main {

	public static void main(String[] args) {
		new Main().run();
	}

	private void run() {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int[] num = new int[n];
		for (int i = 0; i < n; i++) {
			num[i] = scanner.nextInt();
		}
		int m = scanner.nextInt();
		int count = 0;
		while (m-- > 0) {
			int a = scanner.nextInt();
			int l = 0;
			int r = n - 1;
			while (l <= r) {
				int mid = (l + r) / 2;
				if (num[mid] > a) {
					r = mid - 1;
				} else if (num[mid] < a) {
					l = mid + 1;
				} else {
					count++;
					break;
				}
			}
		}
		System.out.println(count);
	}
} public class Main {

	public static void main(String[] args) {
		new Main().run();
	}

	private void run() {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int[] num = new int[n];
		for (int i = 0; i < n; i++) {
			num[i] = scanner.nextInt();
		}
		int m = scanner.nextInt();
		int count = 0;
		while (m-- > 0) {
			int a = scanner.nextInt();
			int l = 0;
			int r = n - 1;
			while (l <= r) {
				int mid = (l + r) / 2;
				if (num[mid] > a) {
					r = mid - 1;
				} else if (num[mid] < a) {
					l = mid + 1;
				} else {
					count++;
					break;
				}
			}
		}
		System.out.println(count);
	}
} Main

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		new Main().run();
	}

	private void run() {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int[] num = new int[n];
		for (int i = 0; i < n; i++) {
			num[i] = scanner.nextInt();
		}
		int m = scanner.nextInt();
		int count = 0;
		while (m-- > 0) {
			int a = scanner.nextInt();
			int l = 0;
			int r = n - 1;
			while (l <= r) {
				int mid = (l + r) / 2;
				if (num[mid] > a) {
					r = mid - 1;
				} else if (num[mid] < a) {
					l = mid + 1;
				} else {
					count++;
					break;
				}
			}
		}
		System.out.println(count);
	}
}