import java.util.Scanner;

public class Main {

	public static int n;
	public static int[] S;
	public static int q;
	public static int[] T;

	public static void main(String[] args) {

		int t = 0;
		Scanner sc = new Scanner(System.in);

		n = sc.nextInt();
		S = new int[n];
		for (int i = 0; i < n; i++) {
			S[i] = sc.nextInt();
		}
		q = sc.nextInt();
		T = new int[q];
		for (int i = 0; i < q; i++) {
			T[i] = sc.nextInt();
		}

		for (int i = 0; i < q; i++) {
			if (binarySearch(T[i])) {
				t++;
			}
		}
		System.out.println(t);
	}

	public static boolean binarySearch(int x) {
		int l = 0;
		int r = n - 1;
		while (true) {
			if (l < r) {
				int m = (l + r) / 2;
				if (S[m] < x) {
					l = m + 1;
				} else {
					r = m;
				}
			} else {
				break;
			}
		}
		if (S[l] == x) {
			return true;
		} else {
			return false;
		}
	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static int n;
	public static int[] S;
	public static int q;
	public static int[] T;

	public static void main(String[] args) {

		int t = 0;
		Scanner sc = new Scanner(System.in);

		n = sc.nextInt();
		S = new int[n];
		for (int i = 0; i < n; i++) {
			S[i] = sc.nextInt();
		}
		q = sc.nextInt();
		T = new int[q];
		for (int i = 0; i < q; i++) {
			T[i] = sc.nextInt();
		}

		for (int i = 0; i < q; i++) {
			if (binarySearch(T[i])) {
				t++;
			}
		}
		System.out.println(t);
	}

	public static boolean binarySearch(int x) {
		int l = 0;
		int r = n - 1;
		while (true) {
			if (l < r) {
				int m = (l + r) / 2;
				if (S[m] < x) {
					l = m + 1;
				} else {
					r = m;
				}
			} else {
				break;
			}
		}
		if (S[l] == x) {
			return true;
		} else {
			return false;
		}
	}

} Main public static int n; n public static int[] S; S public static int q; q public static int[] T; T public static void main(String[] args) {

		int t = 0;
		Scanner sc = new Scanner(System.in);

		n = sc.nextInt();
		S = new int[n];
		for (int i = 0; i < n; i++) {
			S[i] = sc.nextInt();
		}
		q = sc.nextInt();
		T = new int[q];
		for (int i = 0; i < q; i++) {
			T[i] = sc.nextInt();
		}

		for (int i = 0; i < q; i++) {
			if (binarySearch(T[i])) {
				t++;
			}
		}
		System.out.println(t);
	} main {

		int t = 0;
		Scanner sc = new Scanner(System.in);

		n = sc.nextInt();
		S = new int[n];
		for (int i = 0; i < n; i++) {
			S[i] = sc.nextInt();
		}
		q = sc.nextInt();
		T = new int[q];
		for (int i = 0; i < q; i++) {
			T[i] = sc.nextInt();
		}

		for (int i = 0; i < q; i++) {
			if (binarySearch(T[i])) {
				t++;
			}
		}
		System.out.println(t);
	} int t = 0; t 0 Scanner sc = new Scanner(System.in); sc new Scanner(System.in) n = sc.nextInt() n sc.nextInt() sc.nextInt sc S = new int[n] S new int[n] n 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 q = sc.nextInt() q sc.nextInt() sc.nextInt sc T = new int[q] T new int[q] q for (int i = 0; i < q; i++) {
			T[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
			T[i] = sc.nextInt();
		} {
			T[i] = sc.nextInt();
		} T[i] = sc.nextInt() T[i] T i sc.nextInt() sc.nextInt sc for (int i = 0; i < q; i++) {
			if (binarySearch(T[i])) {
				t++;
			}
		} int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
			if (binarySearch(T[i])) {
				t++;
			}
		} {
			if (binarySearch(T[i])) {
				t++;
			}
		} if (binarySearch(T[i])) {
				t++;
			} binarySearch(T[i]) binarySearch T[i] T i {
				t++;
			} t++ t System.out.println(t) System.out.println System.out System System.out t String[] args args public static boolean binarySearch(int x) {
		int l = 0;
		int r = n - 1;
		while (true) {
			if (l < r) {
				int m = (l + r) / 2;
				if (S[m] < x) {
					l = m + 1;
				} else {
					r = m;
				}
			} else {
				break;
			}
		}
		if (S[l] == x) {
			return true;
		} else {
			return false;
		}
	} binarySearch {
		int l = 0;
		int r = n - 1;
		while (true) {
			if (l < r) {
				int m = (l + r) / 2;
				if (S[m] < x) {
					l = m + 1;
				} else {
					r = m;
				}
			} else {
				break;
			}
		}
		if (S[l] == x) {
			return true;
		} else {
			return false;
		}
	} int l = 0; l 0 int r = n - 1; r n - 1 n 1 while (true) {
			if (l < r) {
				int m = (l + r) / 2;
				if (S[m] < x) {
					l = m + 1;
				} else {
					r = m;
				}
			} else {
				break;
			}
		} true {
			if (l < r) {
				int m = (l + r) / 2;
				if (S[m] < x) {
					l = m + 1;
				} else {
					r = m;
				}
			} else {
				break;
			}
		} if (l < r) {
				int m = (l + r) / 2;
				if (S[m] < x) {
					l = m + 1;
				} else {
					r = m;
				}
			} else {
				break;
			} l < r l r {
				int m = (l + r) / 2;
				if (S[m] < x) {
					l = m + 1;
				} else {
					r = m;
				}
			} int m = (l + r) / 2; m (l + r) / 2 (l + r) l r 2 if (S[m] < x) {
					l = m + 1;
				} else {
					r = m;
				} S[m] < x S[m] S m x {
					l = m + 1;
				} l = m + 1 l m + 1 m 1 {
					r = m;
				} r = m r m {
				break;
			} break; if (S[l] == x) {
			return true;
		} else {
			return false;
		} S[l] == x S[l] S l x {
			return true;
		} return true; true {
			return false;
		} return false; false int x x public class Main {

	public static int n;
	public static int[] S;
	public static int q;
	public static int[] T;

	public static void main(String[] args) {

		int t = 0;
		Scanner sc = new Scanner(System.in);

		n = sc.nextInt();
		S = new int[n];
		for (int i = 0; i < n; i++) {
			S[i] = sc.nextInt();
		}
		q = sc.nextInt();
		T = new int[q];
		for (int i = 0; i < q; i++) {
			T[i] = sc.nextInt();
		}

		for (int i = 0; i < q; i++) {
			if (binarySearch(T[i])) {
				t++;
			}
		}
		System.out.println(t);
	}

	public static boolean binarySearch(int x) {
		int l = 0;
		int r = n - 1;
		while (true) {
			if (l < r) {
				int m = (l + r) / 2;
				if (S[m] < x) {
					l = m + 1;
				} else {
					r = m;
				}
			} else {
				break;
			}
		}
		if (S[l] == x) {
			return true;
		} else {
			return false;
		}
	}

} public class Main {

	public static int n;
	public static int[] S;
	public static int q;
	public static int[] T;

	public static void main(String[] args) {

		int t = 0;
		Scanner sc = new Scanner(System.in);

		n = sc.nextInt();
		S = new int[n];
		for (int i = 0; i < n; i++) {
			S[i] = sc.nextInt();
		}
		q = sc.nextInt();
		T = new int[q];
		for (int i = 0; i < q; i++) {
			T[i] = sc.nextInt();
		}

		for (int i = 0; i < q; i++) {
			if (binarySearch(T[i])) {
				t++;
			}
		}
		System.out.println(t);
	}

	public static boolean binarySearch(int x) {
		int l = 0;
		int r = n - 1;
		while (true) {
			if (l < r) {
				int m = (l + r) / 2;
				if (S[m] < x) {
					l = m + 1;
				} else {
					r = m;
				}
			} else {
				break;
			}
		}
		if (S[l] == x) {
			return true;
		} else {
			return false;
		}
	}

} Main
import java.util.Scanner;

public class Main {

	public static int n;
	public static int[] S;
	public static int q;
	public static int[] T;

	public static void main(String[] args) {

		int t = 0;
		Scanner sc = new Scanner(System.in);

		n = sc.nextInt();
		S = new int[n];
		for (int i = 0; i < n; i++) {
			S[i] = sc.nextInt();
		}
		q = sc.nextInt();
		T = new int[q];
		for (int i = 0; i < q; i++) {
			T[i] = sc.nextInt();
		}

		for (int i = 0; i < q; i++) {
			if (binarySearch(T[i])) {
				t++;
			}
		}
		System.out.println(t);
	}

	public static boolean binarySearch(int x) {
		int l = 0;
		int r = n - 1;
		while (true) {
			if (l < r) {
				int m = (l + r) / 2;
				if (S[m] < x) {
					l = m + 1;
				} else {
					r = m;
				}
			} else {
				break;
			}
		}
		if (S[l] == x) {
			return true;
		} else {
			return false;
		}
	}

}
