import java.util.Arrays;
import java.util.Scanner;

public class Main {
	int n, q;
	int[] s, t;
	void run() {
		Scanner scan = new Scanner(System.in);
		n = scan.nextInt();
		s = new int[n];
		for (int i = 0; i < n; i++)
			s[i] = scan.nextInt();
		q = scan.nextInt();
		t = new int[q];
		for (int i = 0; i < q; i++)
			t[i] = scan.nextInt();
		int ans = 0;
		for (int i = 0; i < q; i++) {
			if (binarySearch(t[i]))
				ans++;
		}
		System.out.println(ans);
	}

	boolean binarySearch(int val) {
		int low = 0;
		int high = n - 1;
		while (low <= high) {
			int mid = (low + high) / 2;
			if (s[mid] == val)
				return true;
			else if (s[mid] > val)
				high = mid - 1;
			else
				low = mid + 1;
		}
		return false;
	}

	public static void main(String[] args) {
		new Main().run();
	}
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
	int n, q;
	int[] s, t;
	void run() {
		Scanner scan = new Scanner(System.in);
		n = scan.nextInt();
		s = new int[n];
		for (int i = 0; i < n; i++)
			s[i] = scan.nextInt();
		q = scan.nextInt();
		t = new int[q];
		for (int i = 0; i < q; i++)
			t[i] = scan.nextInt();
		int ans = 0;
		for (int i = 0; i < q; i++) {
			if (binarySearch(t[i]))
				ans++;
		}
		System.out.println(ans);
	}

	boolean binarySearch(int val) {
		int low = 0;
		int high = n - 1;
		while (low <= high) {
			int mid = (low + high) / 2;
			if (s[mid] == val)
				return true;
			else if (s[mid] > val)
				high = mid - 1;
			else
				low = mid + 1;
		}
		return false;
	}

	public static void main(String[] args) {
		new Main().run();
	}
} Main int n n q; q int[] s s t; t void run() {
		Scanner scan = new Scanner(System.in);
		n = scan.nextInt();
		s = new int[n];
		for (int i = 0; i < n; i++)
			s[i] = scan.nextInt();
		q = scan.nextInt();
		t = new int[q];
		for (int i = 0; i < q; i++)
			t[i] = scan.nextInt();
		int ans = 0;
		for (int i = 0; i < q; i++) {
			if (binarySearch(t[i]))
				ans++;
		}
		System.out.println(ans);
	} run {
		Scanner scan = new Scanner(System.in);
		n = scan.nextInt();
		s = new int[n];
		for (int i = 0; i < n; i++)
			s[i] = scan.nextInt();
		q = scan.nextInt();
		t = new int[q];
		for (int i = 0; i < q; i++)
			t[i] = scan.nextInt();
		int ans = 0;
		for (int i = 0; i < q; i++) {
			if (binarySearch(t[i]))
				ans++;
		}
		System.out.println(ans);
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) n = scan.nextInt() n scan.nextInt() scan.nextInt scan s = new int[n] s new int[n] n for (int i = 0; i < n; i++)
			s[i] = scan.nextInt(); int i = 0; int i = 0; i 0 i < n i n i++ i++ i s[i] = scan.nextInt(); s[i] = scan.nextInt() s[i] s i scan.nextInt() scan.nextInt scan q = scan.nextInt() q scan.nextInt() scan.nextInt scan t = new int[q] t new int[q] q for (int i = 0; i < q; i++)
			t[i] = scan.nextInt(); int i = 0; int i = 0; i 0 i < q i q i++ i++ i t[i] = scan.nextInt(); t[i] = scan.nextInt() t[i] t i scan.nextInt() scan.nextInt scan int ans = 0; ans 0 for (int i = 0; i < q; i++) {
			if (binarySearch(t[i]))
				ans++;
		} int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
			if (binarySearch(t[i]))
				ans++;
		} {
			if (binarySearch(t[i]))
				ans++;
		} if (binarySearch(t[i]))
				ans++; binarySearch(t[i]) binarySearch t[i] t i ans++ ans System.out.println(ans) System.out.println System.out System System.out ans boolean binarySearch(int val) {
		int low = 0;
		int high = n - 1;
		while (low <= high) {
			int mid = (low + high) / 2;
			if (s[mid] == val)
				return true;
			else if (s[mid] > val)
				high = mid - 1;
			else
				low = mid + 1;
		}
		return false;
	} binarySearch {
		int low = 0;
		int high = n - 1;
		while (low <= high) {
			int mid = (low + high) / 2;
			if (s[mid] == val)
				return true;
			else if (s[mid] > val)
				high = mid - 1;
			else
				low = mid + 1;
		}
		return false;
	} int low = 0; low 0 int high = n - 1; high n - 1 n 1 while (low <= high) {
			int mid = (low + high) / 2;
			if (s[mid] == val)
				return true;
			else if (s[mid] > val)
				high = mid - 1;
			else
				low = mid + 1;
		} low <= high low high {
			int mid = (low + high) / 2;
			if (s[mid] == val)
				return true;
			else if (s[mid] > val)
				high = mid - 1;
			else
				low = mid + 1;
		} int mid = (low + high) / 2; mid (low + high) / 2 (low + high) low high 2 if (s[mid] == val)
				return true;
			else if (s[mid] > val)
				high = mid - 1;
			else
				low = mid + 1; s[mid] == val s[mid] s mid val return true; true if (s[mid] > val)
				high = mid - 1;
			else
				low = mid + 1; s[mid] > val s[mid] s mid val high = mid - 1 high mid - 1 mid 1 low = mid + 1 low mid + 1 mid 1 return false; false int val val public static void main(String[] args) {
		new Main().run();
	} main {
		new Main().run();
	} new Main().run() new Main().run new Main() String[] args args public class Main {
	int n, q;
	int[] s, t;
	void run() {
		Scanner scan = new Scanner(System.in);
		n = scan.nextInt();
		s = new int[n];
		for (int i = 0; i < n; i++)
			s[i] = scan.nextInt();
		q = scan.nextInt();
		t = new int[q];
		for (int i = 0; i < q; i++)
			t[i] = scan.nextInt();
		int ans = 0;
		for (int i = 0; i < q; i++) {
			if (binarySearch(t[i]))
				ans++;
		}
		System.out.println(ans);
	}

	boolean binarySearch(int val) {
		int low = 0;
		int high = n - 1;
		while (low <= high) {
			int mid = (low + high) / 2;
			if (s[mid] == val)
				return true;
			else if (s[mid] > val)
				high = mid - 1;
			else
				low = mid + 1;
		}
		return false;
	}

	public static void main(String[] args) {
		new Main().run();
	}
} public class Main {
	int n, q;
	int[] s, t;
	void run() {
		Scanner scan = new Scanner(System.in);
		n = scan.nextInt();
		s = new int[n];
		for (int i = 0; i < n; i++)
			s[i] = scan.nextInt();
		q = scan.nextInt();
		t = new int[q];
		for (int i = 0; i < q; i++)
			t[i] = scan.nextInt();
		int ans = 0;
		for (int i = 0; i < q; i++) {
			if (binarySearch(t[i]))
				ans++;
		}
		System.out.println(ans);
	}

	boolean binarySearch(int val) {
		int low = 0;
		int high = n - 1;
		while (low <= high) {
			int mid = (low + high) / 2;
			if (s[mid] == val)
				return true;
			else if (s[mid] > val)
				high = mid - 1;
			else
				low = mid + 1;
		}
		return false;
	}

	public static void main(String[] args) {
		new Main().run();
	}
} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	int n, q;
	int[] s, t;
	void run() {
		Scanner scan = new Scanner(System.in);
		n = scan.nextInt();
		s = new int[n];
		for (int i = 0; i < n; i++)
			s[i] = scan.nextInt();
		q = scan.nextInt();
		t = new int[q];
		for (int i = 0; i < q; i++)
			t[i] = scan.nextInt();
		int ans = 0;
		for (int i = 0; i < q; i++) {
			if (binarySearch(t[i]))
				ans++;
		}
		System.out.println(ans);
	}

	boolean binarySearch(int val) {
		int low = 0;
		int high = n - 1;
		while (low <= high) {
			int mid = (low + high) / 2;
			if (s[mid] == val)
				return true;
			else if (s[mid] > val)
				high = mid - 1;
			else
				low = mid + 1;
		}
		return false;
	}

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