
import java.io.*;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(
			new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String S[] = br.readLine().split(" ");
		int q = Integer.parseInt(br.readLine());
		String T[] = br.readLine().split(" ");
		int count = 0;
		for (int i = 0; i < q; i++) {
			if (binarysarch(S, T[i]) != -1) count++;
		}
		System.out.println(count);
	}
	public static int binarysarch(String[] S, String x) {
		int lx = 0, rx = S.length - 1;
		while (lx <= rx) {
			int c = (lx + rx) / 2;
			if (Integer.parseInt(S[c]) == Integer.parseInt(x)) {
				return c;
			} else if (Integer.parseInt(S[c]) < Integer.parseInt(x)) {
				lx = c + 1;
			} else {
				rx = c - 1;
			}
		}
		return -1;
	}
} import java.io.*; io.* java public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(
			new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String S[] = br.readLine().split(" ");
		int q = Integer.parseInt(br.readLine());
		String T[] = br.readLine().split(" ");
		int count = 0;
		for (int i = 0; i < q; i++) {
			if (binarysarch(S, T[i]) != -1) count++;
		}
		System.out.println(count);
	}
	public static int binarysarch(String[] S, String x) {
		int lx = 0, rx = S.length - 1;
		while (lx <= rx) {
			int c = (lx + rx) / 2;
			if (Integer.parseInt(S[c]) == Integer.parseInt(x)) {
				return c;
			} else if (Integer.parseInt(S[c]) < Integer.parseInt(x)) {
				lx = c + 1;
			} else {
				rx = c - 1;
			}
		}
		return -1;
	}
} Main public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(
			new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String S[] = br.readLine().split(" ");
		int q = Integer.parseInt(br.readLine());
		String T[] = br.readLine().split(" ");
		int count = 0;
		for (int i = 0; i < q; i++) {
			if (binarysarch(S, T[i]) != -1) count++;
		}
		System.out.println(count);
	} main {
		BufferedReader br = new BufferedReader(
			new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String S[] = br.readLine().split(" ");
		int q = Integer.parseInt(br.readLine());
		String T[] = br.readLine().split(" ");
		int count = 0;
		for (int i = 0; i < q; i++) {
			if (binarysarch(S, T[i]) != -1) count++;
		}
		System.out.println(count);
	} BufferedReader br = new BufferedReader(
			new InputStreamReader(System.in)); br new BufferedReader(
			new InputStreamReader(System.in)) int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br String S[] = br.readLine().split(" "); S br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int q = Integer.parseInt(br.readLine()); q Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br String T[] = br.readLine().split(" "); T br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int count = 0; count 0 for (int i = 0; i < q; i++) {
			if (binarysarch(S, T[i]) != -1) count++;
		} int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
			if (binarysarch(S, T[i]) != -1) count++;
		} {
			if (binarysarch(S, T[i]) != -1) count++;
		} if (binarysarch(S, T[i]) != -1) count++; binarysarch(S, T[i]) != -1 binarysarch(S, T[i]) binarysarch S T[i] T i -1 1 count++ count System.out.println(count) System.out.println System.out System System.out count String[] args args public static int binarysarch(String[] S, String x) {
		int lx = 0, rx = S.length - 1;
		while (lx <= rx) {
			int c = (lx + rx) / 2;
			if (Integer.parseInt(S[c]) == Integer.parseInt(x)) {
				return c;
			} else if (Integer.parseInt(S[c]) < Integer.parseInt(x)) {
				lx = c + 1;
			} else {
				rx = c - 1;
			}
		}
		return -1;
	} binarysarch {
		int lx = 0, rx = S.length - 1;
		while (lx <= rx) {
			int c = (lx + rx) / 2;
			if (Integer.parseInt(S[c]) == Integer.parseInt(x)) {
				return c;
			} else if (Integer.parseInt(S[c]) < Integer.parseInt(x)) {
				lx = c + 1;
			} else {
				rx = c - 1;
			}
		}
		return -1;
	} int lx = 0 lx 0 rx = S.length - 1; rx S.length - 1 S.length S S.length 1 while (lx <= rx) {
			int c = (lx + rx) / 2;
			if (Integer.parseInt(S[c]) == Integer.parseInt(x)) {
				return c;
			} else if (Integer.parseInt(S[c]) < Integer.parseInt(x)) {
				lx = c + 1;
			} else {
				rx = c - 1;
			}
		} lx <= rx lx rx {
			int c = (lx + rx) / 2;
			if (Integer.parseInt(S[c]) == Integer.parseInt(x)) {
				return c;
			} else if (Integer.parseInt(S[c]) < Integer.parseInt(x)) {
				lx = c + 1;
			} else {
				rx = c - 1;
			}
		} int c = (lx + rx) / 2; c (lx + rx) / 2 (lx + rx) lx rx 2 if (Integer.parseInt(S[c]) == Integer.parseInt(x)) {
				return c;
			} else if (Integer.parseInt(S[c]) < Integer.parseInt(x)) {
				lx = c + 1;
			} else {
				rx = c - 1;
			} Integer.parseInt(S[c]) == Integer.parseInt(x) Integer.parseInt(S[c]) Integer.parseInt Integer S[c] S c Integer.parseInt(x) Integer.parseInt Integer x {
				return c;
			} return c; c if (Integer.parseInt(S[c]) < Integer.parseInt(x)) {
				lx = c + 1;
			} else {
				rx = c - 1;
			} Integer.parseInt(S[c]) < Integer.parseInt(x) Integer.parseInt(S[c]) Integer.parseInt Integer S[c] S c Integer.parseInt(x) Integer.parseInt Integer x {
				lx = c + 1;
			} lx = c + 1 lx c + 1 c 1 {
				rx = c - 1;
			} rx = c - 1 rx c - 1 c 1 return -1; -1 1 String[] S S String x x public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(
			new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String S[] = br.readLine().split(" ");
		int q = Integer.parseInt(br.readLine());
		String T[] = br.readLine().split(" ");
		int count = 0;
		for (int i = 0; i < q; i++) {
			if (binarysarch(S, T[i]) != -1) count++;
		}
		System.out.println(count);
	}
	public static int binarysarch(String[] S, String x) {
		int lx = 0, rx = S.length - 1;
		while (lx <= rx) {
			int c = (lx + rx) / 2;
			if (Integer.parseInt(S[c]) == Integer.parseInt(x)) {
				return c;
			} else if (Integer.parseInt(S[c]) < Integer.parseInt(x)) {
				lx = c + 1;
			} else {
				rx = c - 1;
			}
		}
		return -1;
	}
} public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(
			new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String S[] = br.readLine().split(" ");
		int q = Integer.parseInt(br.readLine());
		String T[] = br.readLine().split(" ");
		int count = 0;
		for (int i = 0; i < q; i++) {
			if (binarysarch(S, T[i]) != -1) count++;
		}
		System.out.println(count);
	}
	public static int binarysarch(String[] S, String x) {
		int lx = 0, rx = S.length - 1;
		while (lx <= rx) {
			int c = (lx + rx) / 2;
			if (Integer.parseInt(S[c]) == Integer.parseInt(x)) {
				return c;
			} else if (Integer.parseInt(S[c]) < Integer.parseInt(x)) {
				lx = c + 1;
			} else {
				rx = c - 1;
			}
		}
		return -1;
	}
} Main

import java.io.*;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(
			new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String S[] = br.readLine().split(" ");
		int q = Integer.parseInt(br.readLine());
		String T[] = br.readLine().split(" ");
		int count = 0;
		for (int i = 0; i < q; i++) {
			if (binarysarch(S, T[i]) != -1) count++;
		}
		System.out.println(count);
	}
	public static int binarysarch(String[] S, String x) {
		int lx = 0, rx = S.length - 1;
		while (lx <= rx) {
			int c = (lx + rx) / 2;
			if (Integer.parseInt(S[c]) == Integer.parseInt(x)) {
				return c;
			} else if (Integer.parseInt(S[c]) < Integer.parseInt(x)) {
				lx = c + 1;
			} else {
				rx = c - 1;
			}
		}
		return -1;
	}
}