import java.util.Scanner;

/**
 * 二分探索
 * @author nobu
 * @see <a href="http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_4_B&lang=ja">ALDS1_4_B</a>
 */
public class Main {

	private static final int NOT_FOUND = -1;

	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();
		}

		int answer = 0;
		for (int i = 0; i < q; i++) {
			if (binarySearch(s, t[i]) != -1) answer++;
		}

		System.out.println(answer);

		sc.close();
	}

	private static int binarySearch(int x[], int key) {
		int left = 0;
		int right = x.length;
		int mid;

		while (left < right) {
			mid = (left + right) / 2;
			if (x[mid] == key) return mid;
			if (key < x[mid]) {
				right = mid;
			} else {
				left = mid + 1;
			}
		}
		return NOT_FOUND;
	}

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

	private static final int NOT_FOUND = -1;

	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();
		}

		int answer = 0;
		for (int i = 0; i < q; i++) {
			if (binarySearch(s, t[i]) != -1) answer++;
		}

		System.out.println(answer);

		sc.close();
	}

	private static int binarySearch(int x[], int key) {
		int left = 0;
		int right = x.length;
		int mid;

		while (left < right) {
			mid = (left + right) / 2;
			if (x[mid] == key) return mid;
			if (key < x[mid]) {
				right = mid;
			} else {
				left = mid + 1;
			}
		}
		return NOT_FOUND;
	}

} Main private static final int NOT_FOUND = -1; NOT_FOUND -1 1 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();
		}

		int answer = 0;
		for (int i = 0; i < q; i++) {
			if (binarySearch(s, t[i]) != -1) answer++;
		}

		System.out.println(answer);

		sc.close();
	} 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();
		}

		int answer = 0;
		for (int i = 0; i < q; i++) {
			if (binarySearch(s, t[i]) != -1) answer++;
		}

		System.out.println(answer);

		sc.close();
	} 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 int answer = 0; answer 0 for (int i = 0; i < q; i++) {
			if (binarySearch(s, t[i]) != -1) answer++;
		} int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
			if (binarySearch(s, t[i]) != -1) answer++;
		} {
			if (binarySearch(s, t[i]) != -1) answer++;
		} if (binarySearch(s, t[i]) != -1) answer++; binarySearch(s, t[i]) != -1 binarySearch(s, t[i]) binarySearch s t[i] t i -1 1 answer++ answer System.out.println(answer) System.out.println System.out System System.out answer sc.close() sc.close sc String[] args args private static int binarySearch(int x[], int key) {
		int left = 0;
		int right = x.length;
		int mid;

		while (left < right) {
			mid = (left + right) / 2;
			if (x[mid] == key) return mid;
			if (key < x[mid]) {
				right = mid;
			} else {
				left = mid + 1;
			}
		}
		return NOT_FOUND;
	} binarySearch {
		int left = 0;
		int right = x.length;
		int mid;

		while (left < right) {
			mid = (left + right) / 2;
			if (x[mid] == key) return mid;
			if (key < x[mid]) {
				right = mid;
			} else {
				left = mid + 1;
			}
		}
		return NOT_FOUND;
	} int left = 0; left 0 int right = x.length; right x.length x x.length int mid; mid while (left < right) {
			mid = (left + right) / 2;
			if (x[mid] == key) return mid;
			if (key < x[mid]) {
				right = mid;
			} else {
				left = mid + 1;
			}
		} left < right left right {
			mid = (left + right) / 2;
			if (x[mid] == key) return mid;
			if (key < x[mid]) {
				right = mid;
			} else {
				left = mid + 1;
			}
		} mid = (left + right) / 2 mid (left + right) / 2 (left + right) left right 2 if (x[mid] == key) return mid; x[mid] == key x[mid] x mid key return mid; mid if (key < x[mid]) {
				right = mid;
			} else {
				left = mid + 1;
			} key < x[mid] key x[mid] x mid {
				right = mid;
			} right = mid right mid {
				left = mid + 1;
			} left = mid + 1 left mid + 1 mid 1 return NOT_FOUND; NOT_FOUND int x[] x int key key public class Main {

	private static final int NOT_FOUND = -1;

	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();
		}

		int answer = 0;
		for (int i = 0; i < q; i++) {
			if (binarySearch(s, t[i]) != -1) answer++;
		}

		System.out.println(answer);

		sc.close();
	}

	private static int binarySearch(int x[], int key) {
		int left = 0;
		int right = x.length;
		int mid;

		while (left < right) {
			mid = (left + right) / 2;
			if (x[mid] == key) return mid;
			if (key < x[mid]) {
				right = mid;
			} else {
				left = mid + 1;
			}
		}
		return NOT_FOUND;
	}

} public class Main {

	private static final int NOT_FOUND = -1;

	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();
		}

		int answer = 0;
		for (int i = 0; i < q; i++) {
			if (binarySearch(s, t[i]) != -1) answer++;
		}

		System.out.println(answer);

		sc.close();
	}

	private static int binarySearch(int x[], int key) {
		int left = 0;
		int right = x.length;
		int mid;

		while (left < right) {
			mid = (left + right) / 2;
			if (x[mid] == key) return mid;
			if (key < x[mid]) {
				right = mid;
			} else {
				left = mid + 1;
			}
		}
		return NOT_FOUND;
	}

} Main
import java.util.Scanner;

/**
 * 二分探索
 * @author nobu
 * @see <a href="http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_4_B&lang=ja">ALDS1_4_B</a>
 */
public class Main {

	private static final int NOT_FOUND = -1;

	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();
		}

		int answer = 0;
		for (int i = 0; i < q; i++) {
			if (binarySearch(s, t[i]) != -1) answer++;
		}

		System.out.println(answer);

		sc.close();
	}

	private static int binarySearch(int x[], int key) {
		int left = 0;
		int right = x.length;
		int mid;

		while (left < right) {
			mid = (left + right) / 2;
			if (x[mid] == key) return mid;
			if (key < x[mid]) {
				right = mid;
			} else {
				left = mid + 1;
			}
		}
		return NOT_FOUND;
	}

}

