import java.io.InputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	private static boolean binarySearch(int[] a, int st, int ed, int k) {
		if (st == ed - 1) {
			return a[st] == k;
		}

		int idx = (ed - st) / 2 + st;
		int m = a[idx];

		if (m == k) {
			return true;
		} else if (m > k) {
			return binarySearch(a, st, idx, k);
		} else if (m < k) {
			return binarySearch(a, idx, ed, k);
		}

		return false; // 到達しない

	}

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int n = sc.nextInt();
		int[] S = nextIntArray(sc, n);

		int q = sc.nextInt();
		int[] T = nextIntArray(sc, q);

		sc.close();

		int ans = 0;

		for (int i = 0; i < q; i++) {
			if (binarySearch(S, 0, n, T[i])) {
				ans++;
			}
		}

		out.println(ans);

	}

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

	@SuppressWarnings("unused")
	private int[] nextIntArray(Scanner sc, int n) {
		int[] result = new int[n];
		for (int i = 0; i < n; i++) {
			result[i] = sc.nextInt();
		}
		return result;
	}
}
 import java.io.InputStream; InputStream java.io import java.io.PrintStream; PrintStream java.io import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	private static boolean binarySearch(int[] a, int st, int ed, int k) {
		if (st == ed - 1) {
			return a[st] == k;
		}

		int idx = (ed - st) / 2 + st;
		int m = a[idx];

		if (m == k) {
			return true;
		} else if (m > k) {
			return binarySearch(a, st, idx, k);
		} else if (m < k) {
			return binarySearch(a, idx, ed, k);
		}

		return false; // 到達しない

	}

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int n = sc.nextInt();
		int[] S = nextIntArray(sc, n);

		int q = sc.nextInt();
		int[] T = nextIntArray(sc, q);

		sc.close();

		int ans = 0;

		for (int i = 0; i < q; i++) {
			if (binarySearch(S, 0, n, T[i])) {
				ans++;
			}
		}

		out.println(ans);

	}

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

	@SuppressWarnings("unused")
	private int[] nextIntArray(Scanner sc, int n) {
		int[] result = new int[n];
		for (int i = 0; i < n; i++) {
			result[i] = sc.nextInt();
		}
		return result;
	}
} Main InputStream in = System.in; in System.in System System.in PrintStream out = System.out; out System.out System System.out private static boolean binarySearch(int[] a, int st, int ed, int k) {
		if (st == ed - 1) {
			return a[st] == k;
		}

		int idx = (ed - st) / 2 + st;
		int m = a[idx];

		if (m == k) {
			return true;
		} else if (m > k) {
			return binarySearch(a, st, idx, k);
		} else if (m < k) {
			return binarySearch(a, idx, ed, k);
		}

		return false; // 到達しない

	} binarySearch {
		if (st == ed - 1) {
			return a[st] == k;
		}

		int idx = (ed - st) / 2 + st;
		int m = a[idx];

		if (m == k) {
			return true;
		} else if (m > k) {
			return binarySearch(a, st, idx, k);
		} else if (m < k) {
			return binarySearch(a, idx, ed, k);
		}

		return false; // 到達しない

	} if (st == ed - 1) {
			return a[st] == k;
		} st == ed - 1 st ed - 1 ed 1 {
			return a[st] == k;
		} return a[st] == k; a[st] == k a[st] a st k int idx = (ed - st) / 2 + st; idx (ed - st) / 2 + st (ed - st) / 2 (ed - st) ed st 2 st int m = a[idx]; m a[idx] a idx if (m == k) {
			return true;
		} else if (m > k) {
			return binarySearch(a, st, idx, k);
		} else if (m < k) {
			return binarySearch(a, idx, ed, k);
		} m == k m k {
			return true;
		} return true; true if (m > k) {
			return binarySearch(a, st, idx, k);
		} else if (m < k) {
			return binarySearch(a, idx, ed, k);
		} m > k m k {
			return binarySearch(a, st, idx, k);
		} return binarySearch(a, st, idx, k); binarySearch(a, st, idx, k) binarySearch a st idx k if (m < k) {
			return binarySearch(a, idx, ed, k);
		} m < k m k {
			return binarySearch(a, idx, ed, k);
		} return binarySearch(a, idx, ed, k); binarySearch(a, idx, ed, k) binarySearch a idx ed k return false; // 到達しない false int[] a a int st st int ed ed int k k public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int n = sc.nextInt();
		int[] S = nextIntArray(sc, n);

		int q = sc.nextInt();
		int[] T = nextIntArray(sc, q);

		sc.close();

		int ans = 0;

		for (int i = 0; i < q; i++) {
			if (binarySearch(S, 0, n, T[i])) {
				ans++;
			}
		}

		out.println(ans);

	} _main {
		Scanner sc = new Scanner(in);

		int n = sc.nextInt();
		int[] S = nextIntArray(sc, n);

		int q = sc.nextInt();
		int[] T = nextIntArray(sc, q);

		sc.close();

		int ans = 0;

		for (int i = 0; i < q; i++) {
			if (binarySearch(S, 0, n, T[i])) {
				ans++;
			}
		}

		out.println(ans);

	} Scanner sc = new Scanner(in); sc new Scanner(in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] S = nextIntArray(sc, n); S nextIntArray(sc, n) nextIntArray sc n int q = sc.nextInt(); q sc.nextInt() sc.nextInt sc int[] T = nextIntArray(sc, q); T nextIntArray(sc, q) nextIntArray sc q sc.close() sc.close sc int ans = 0; ans 0 for (int i = 0; i < q; i++) {
			if (binarySearch(S, 0, n, T[i])) {
				ans++;
			}
		} int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
			if (binarySearch(S, 0, n, T[i])) {
				ans++;
			}
		} {
			if (binarySearch(S, 0, n, T[i])) {
				ans++;
			}
		} if (binarySearch(S, 0, n, T[i])) {
				ans++;
			} binarySearch(S, 0, n, T[i]) binarySearch S 0 n T[i] T i {
				ans++;
			} ans++ ans out.println(ans) out.println out ans String[] args args public static void main(String[] args) {
		new Main()._main(args);
	} main {
		new Main()._main(args);
	} new Main()._main(args) new Main()._main new Main() args String[] args args @SuppressWarnings("unused")
	private int[] nextIntArray(Scanner sc, int n) {
		int[] result = new int[n];
		for (int i = 0; i < n; i++) {
			result[i] = sc.nextInt();
		}
		return result;
	} nextIntArray {
		int[] result = new int[n];
		for (int i = 0; i < n; i++) {
			result[i] = sc.nextInt();
		}
		return result;
	} int[] result = new int[n]; result new int[n] n for (int i = 0; i < n; i++) {
			result[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			result[i] = sc.nextInt();
		} {
			result[i] = sc.nextInt();
		} result[i] = sc.nextInt() result[i] result i sc.nextInt() sc.nextInt sc return result; result Scanner sc sc int n n public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	private static boolean binarySearch(int[] a, int st, int ed, int k) {
		if (st == ed - 1) {
			return a[st] == k;
		}

		int idx = (ed - st) / 2 + st;
		int m = a[idx];

		if (m == k) {
			return true;
		} else if (m > k) {
			return binarySearch(a, st, idx, k);
		} else if (m < k) {
			return binarySearch(a, idx, ed, k);
		}

		return false; // 到達しない

	}

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int n = sc.nextInt();
		int[] S = nextIntArray(sc, n);

		int q = sc.nextInt();
		int[] T = nextIntArray(sc, q);

		sc.close();

		int ans = 0;

		for (int i = 0; i < q; i++) {
			if (binarySearch(S, 0, n, T[i])) {
				ans++;
			}
		}

		out.println(ans);

	}

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

	@SuppressWarnings("unused")
	private int[] nextIntArray(Scanner sc, int n) {
		int[] result = new int[n];
		for (int i = 0; i < n; i++) {
			result[i] = sc.nextInt();
		}
		return result;
	}
} public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	private static boolean binarySearch(int[] a, int st, int ed, int k) {
		if (st == ed - 1) {
			return a[st] == k;
		}

		int idx = (ed - st) / 2 + st;
		int m = a[idx];

		if (m == k) {
			return true;
		} else if (m > k) {
			return binarySearch(a, st, idx, k);
		} else if (m < k) {
			return binarySearch(a, idx, ed, k);
		}

		return false; // 到達しない

	}

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int n = sc.nextInt();
		int[] S = nextIntArray(sc, n);

		int q = sc.nextInt();
		int[] T = nextIntArray(sc, q);

		sc.close();

		int ans = 0;

		for (int i = 0; i < q; i++) {
			if (binarySearch(S, 0, n, T[i])) {
				ans++;
			}
		}

		out.println(ans);

	}

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

	@SuppressWarnings("unused")
	private int[] nextIntArray(Scanner sc, int n) {
		int[] result = new int[n];
		for (int i = 0; i < n; i++) {
			result[i] = sc.nextInt();
		}
		return result;
	}
} Main
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	private static boolean binarySearch(int[] a, int st, int ed, int k) {
		if (st == ed - 1) {
			return a[st] == k;
		}

		int idx = (ed - st) / 2 + st;
		int m = a[idx];

		if (m == k) {
			return true;
		} else if (m > k) {
			return binarySearch(a, st, idx, k);
		} else if (m < k) {
			return binarySearch(a, idx, ed, k);
		}

		return false; // 到達しない

	}

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int n = sc.nextInt();
		int[] S = nextIntArray(sc, n);

		int q = sc.nextInt();
		int[] T = nextIntArray(sc, q);

		sc.close();

		int ans = 0;

		for (int i = 0; i < q; i++) {
			if (binarySearch(S, 0, n, T[i])) {
				ans++;
			}
		}

		out.println(ans);

	}

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

	@SuppressWarnings("unused")
	private int[] nextIntArray(Scanner sc, int n) {
		int[] result = new int[n];
		for (int i = 0; i < n; i++) {
			result[i] = sc.nextInt();
		}
		return result;
	}
}

