

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int s[] = new int[n];
		for (int i = 0; i < n; i++) {
			s[i] = sc.nextInt();
		}

		int q = sc.nextInt();
		int t[] = new int[q];

		for (int i = 0; i < q; i++) {
			t[i] = sc.nextInt();
		}

		System.out.println(countNumbers(n, s, q, t));
	}

	public static boolean isIncludeNumber(int n, int s[], int num) {
		for (int i = 0; i < n; i++) {
			if (s[i] == num) {
				return true;
			}
		}
		return false;
	}

	public static int countNumbers(int n, int s[], int q, int t[]) {
		int count = 0;
		for (int j = 0; j < q; j++) {
			if (isIncludeNumber(n, s, t[j])) {
				count++;
			}
		}
		return count;
	}
}
 import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int s[] = new int[n];
		for (int i = 0; i < n; i++) {
			s[i] = sc.nextInt();
		}

		int q = sc.nextInt();
		int t[] = new int[q];

		for (int i = 0; i < q; i++) {
			t[i] = sc.nextInt();
		}

		System.out.println(countNumbers(n, s, q, t));
	}

	public static boolean isIncludeNumber(int n, int s[], int num) {
		for (int i = 0; i < n; i++) {
			if (s[i] == num) {
				return true;
			}
		}
		return false;
	}

	public static int countNumbers(int n, int s[], int q, int t[]) {
		int count = 0;
		for (int j = 0; j < q; j++) {
			if (isIncludeNumber(n, s, t[j])) {
				count++;
			}
		}
		return count;
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int s[] = new int[n];
		for (int i = 0; i < n; i++) {
			s[i] = sc.nextInt();
		}

		int q = sc.nextInt();
		int t[] = new int[q];

		for (int i = 0; i < q; i++) {
			t[i] = sc.nextInt();
		}

		System.out.println(countNumbers(n, s, q, t));
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int s[] = new int[n];
		for (int i = 0; i < n; i++) {
			s[i] = sc.nextInt();
		}

		int q = sc.nextInt();
		int t[] = new int[q];

		for (int i = 0; i < q; i++) {
			t[i] = sc.nextInt();
		}

		System.out.println(countNumbers(n, s, q, t));
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int 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 int q = sc.nextInt(); q sc.nextInt() sc.nextInt sc int 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 System.out.println(countNumbers(n, s, q, t)) System.out.println System.out System System.out countNumbers(n, s, q, t) countNumbers n s q t String[] args args public static boolean isIncludeNumber(int n, int s[], int num) {
		for (int i = 0; i < n; i++) {
			if (s[i] == num) {
				return true;
			}
		}
		return false;
	} isIncludeNumber {
		for (int i = 0; i < n; i++) {
			if (s[i] == num) {
				return true;
			}
		}
		return false;
	} for (int i = 0; i < n; i++) {
			if (s[i] == num) {
				return true;
			}
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			if (s[i] == num) {
				return true;
			}
		} {
			if (s[i] == num) {
				return true;
			}
		} if (s[i] == num) {
				return true;
			} s[i] == num s[i] s i num {
				return true;
			} return true; true return false; false int n n int s[] s int num num public static int countNumbers(int n, int s[], int q, int t[]) {
		int count = 0;
		for (int j = 0; j < q; j++) {
			if (isIncludeNumber(n, s, t[j])) {
				count++;
			}
		}
		return count;
	} countNumbers {
		int count = 0;
		for (int j = 0; j < q; j++) {
			if (isIncludeNumber(n, s, t[j])) {
				count++;
			}
		}
		return count;
	} int count = 0; count 0 for (int j = 0; j < q; j++) {
			if (isIncludeNumber(n, s, t[j])) {
				count++;
			}
		} int j = 0; int j = 0; j 0 j < q j q j++ j++ j {
			if (isIncludeNumber(n, s, t[j])) {
				count++;
			}
		} {
			if (isIncludeNumber(n, s, t[j])) {
				count++;
			}
		} if (isIncludeNumber(n, s, t[j])) {
				count++;
			} isIncludeNumber(n, s, t[j]) isIncludeNumber n s t[j] t j {
				count++;
			} count++ count return count; count int n n int s[] s int q q int t[] t public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int s[] = new int[n];
		for (int i = 0; i < n; i++) {
			s[i] = sc.nextInt();
		}

		int q = sc.nextInt();
		int t[] = new int[q];

		for (int i = 0; i < q; i++) {
			t[i] = sc.nextInt();
		}

		System.out.println(countNumbers(n, s, q, t));
	}

	public static boolean isIncludeNumber(int n, int s[], int num) {
		for (int i = 0; i < n; i++) {
			if (s[i] == num) {
				return true;
			}
		}
		return false;
	}

	public static int countNumbers(int n, int s[], int q, int t[]) {
		int count = 0;
		for (int j = 0; j < q; j++) {
			if (isIncludeNumber(n, s, t[j])) {
				count++;
			}
		}
		return count;
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int s[] = new int[n];
		for (int i = 0; i < n; i++) {
			s[i] = sc.nextInt();
		}

		int q = sc.nextInt();
		int t[] = new int[q];

		for (int i = 0; i < q; i++) {
			t[i] = sc.nextInt();
		}

		System.out.println(countNumbers(n, s, q, t));
	}

	public static boolean isIncludeNumber(int n, int s[], int num) {
		for (int i = 0; i < n; i++) {
			if (s[i] == num) {
				return true;
			}
		}
		return false;
	}

	public static int countNumbers(int n, int s[], int q, int t[]) {
		int count = 0;
		for (int j = 0; j < q; j++) {
			if (isIncludeNumber(n, s, t[j])) {
				count++;
			}
		}
		return count;
	}
} Main


import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int s[] = new int[n];
		for (int i = 0; i < n; i++) {
			s[i] = sc.nextInt();
		}

		int q = sc.nextInt();
		int t[] = new int[q];

		for (int i = 0; i < q; i++) {
			t[i] = sc.nextInt();
		}

		System.out.println(countNumbers(n, s, q, t));
	}

	public static boolean isIncludeNumber(int n, int s[], int num) {
		for (int i = 0; i < n; i++) {
			if (s[i] == num) {
				return true;
			}
		}
		return false;
	}

	public static int countNumbers(int n, int s[], int q, int t[]) {
		int count = 0;
		for (int j = 0; j < q; j++) {
			if (isIncludeNumber(n, s, t[j])) {
				count++;
			}
		}
		return count;
	}
}

