import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {

	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());

		String[] ss = br.readLine().split(" ");

		int[] S = new int[n];

		for (int i = 0; i < n; i++) {
			S[i] = Integer.parseInt(ss[i]);
		}

		int q = Integer.parseInt(br.readLine());

		String[] qq = br.readLine().split(" ");

		int[] Q = new int[q];

		for (int i = 0; i < q; i++) {
			Q[i] = Integer.parseInt(qq[i]);
		}

		System.out.println(binarySearch(S, Q));

	}

	static int binarySearch(int[] nums, int[] key) {

		int i = 0;

		int count = 0;

		while (i != key.length) {

			int left = 0;

			int right = nums.length;

			while (left < right) {

				int mid = (left + right) / 2;

				if (nums[mid] == key[i]) {
					count++;
					break;
				} else if (nums[mid] > key[i]) {
					right = mid;
				} else {
					left = mid + 1;
				}
			}
			i++;

		}

		return count;

	}

} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io class Main {

	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());

		String[] ss = br.readLine().split(" ");

		int[] S = new int[n];

		for (int i = 0; i < n; i++) {
			S[i] = Integer.parseInt(ss[i]);
		}

		int q = Integer.parseInt(br.readLine());

		String[] qq = br.readLine().split(" ");

		int[] Q = new int[q];

		for (int i = 0; i < q; i++) {
			Q[i] = Integer.parseInt(qq[i]);
		}

		System.out.println(binarySearch(S, Q));

	}

	static int binarySearch(int[] nums, int[] key) {

		int i = 0;

		int count = 0;

		while (i != key.length) {

			int left = 0;

			int right = nums.length;

			while (left < right) {

				int mid = (left + right) / 2;

				if (nums[mid] == key[i]) {
					count++;
					break;
				} else if (nums[mid] > key[i]) {
					right = mid;
				} else {
					left = mid + 1;
				}
			}
			i++;

		}

		return count;

	}

} Main public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());

		String[] ss = br.readLine().split(" ");

		int[] S = new int[n];

		for (int i = 0; i < n; i++) {
			S[i] = Integer.parseInt(ss[i]);
		}

		int q = Integer.parseInt(br.readLine());

		String[] qq = br.readLine().split(" ");

		int[] Q = new int[q];

		for (int i = 0; i < q; i++) {
			Q[i] = Integer.parseInt(qq[i]);
		}

		System.out.println(binarySearch(S, Q));

	} main {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());

		String[] ss = br.readLine().split(" ");

		int[] S = new int[n];

		for (int i = 0; i < n; i++) {
			S[i] = Integer.parseInt(ss[i]);
		}

		int q = Integer.parseInt(br.readLine());

		String[] qq = br.readLine().split(" ");

		int[] Q = new int[q];

		for (int i = 0; i < q; i++) {
			Q[i] = Integer.parseInt(qq[i]);
		}

		System.out.println(binarySearch(S, Q));

	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br String[] ss = br.readLine().split(" "); ss br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int[] S = new int[n]; S new int[n] n for (int i = 0; i < n; i++) {
			S[i] = Integer.parseInt(ss[i]);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			S[i] = Integer.parseInt(ss[i]);
		} {
			S[i] = Integer.parseInt(ss[i]);
		} S[i] = Integer.parseInt(ss[i]) S[i] S i Integer.parseInt(ss[i]) Integer.parseInt Integer ss[i] ss i int q = Integer.parseInt(br.readLine()); q Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br String[] qq = br.readLine().split(" "); qq br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int[] Q = new int[q]; Q new int[q] q for (int i = 0; i < q; i++) {
			Q[i] = Integer.parseInt(qq[i]);
		} int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
			Q[i] = Integer.parseInt(qq[i]);
		} {
			Q[i] = Integer.parseInt(qq[i]);
		} Q[i] = Integer.parseInt(qq[i]) Q[i] Q i Integer.parseInt(qq[i]) Integer.parseInt Integer qq[i] qq i System.out.println(binarySearch(S, Q)) System.out.println System.out System System.out binarySearch(S, Q) binarySearch S Q String[] args args static int binarySearch(int[] nums, int[] key) {

		int i = 0;

		int count = 0;

		while (i != key.length) {

			int left = 0;

			int right = nums.length;

			while (left < right) {

				int mid = (left + right) / 2;

				if (nums[mid] == key[i]) {
					count++;
					break;
				} else if (nums[mid] > key[i]) {
					right = mid;
				} else {
					left = mid + 1;
				}
			}
			i++;

		}

		return count;

	} binarySearch {

		int i = 0;

		int count = 0;

		while (i != key.length) {

			int left = 0;

			int right = nums.length;

			while (left < right) {

				int mid = (left + right) / 2;

				if (nums[mid] == key[i]) {
					count++;
					break;
				} else if (nums[mid] > key[i]) {
					right = mid;
				} else {
					left = mid + 1;
				}
			}
			i++;

		}

		return count;

	} int i = 0; i 0 int count = 0; count 0 while (i != key.length) {

			int left = 0;

			int right = nums.length;

			while (left < right) {

				int mid = (left + right) / 2;

				if (nums[mid] == key[i]) {
					count++;
					break;
				} else if (nums[mid] > key[i]) {
					right = mid;
				} else {
					left = mid + 1;
				}
			}
			i++;

		} i != key.length i key.length key key.length {

			int left = 0;

			int right = nums.length;

			while (left < right) {

				int mid = (left + right) / 2;

				if (nums[mid] == key[i]) {
					count++;
					break;
				} else if (nums[mid] > key[i]) {
					right = mid;
				} else {
					left = mid + 1;
				}
			}
			i++;

		} int left = 0; left 0 int right = nums.length; right nums.length nums nums.length while (left < right) {

				int mid = (left + right) / 2;

				if (nums[mid] == key[i]) {
					count++;
					break;
				} else if (nums[mid] > key[i]) {
					right = mid;
				} else {
					left = mid + 1;
				}
			} left < right left right {

				int mid = (left + right) / 2;

				if (nums[mid] == key[i]) {
					count++;
					break;
				} else if (nums[mid] > key[i]) {
					right = mid;
				} else {
					left = mid + 1;
				}
			} int mid = (left + right) / 2; mid (left + right) / 2 (left + right) left right 2 if (nums[mid] == key[i]) {
					count++;
					break;
				} else if (nums[mid] > key[i]) {
					right = mid;
				} else {
					left = mid + 1;
				} nums[mid] == key[i] nums[mid] nums mid key[i] key i {
					count++;
					break;
				} count++ count break; if (nums[mid] > key[i]) {
					right = mid;
				} else {
					left = mid + 1;
				} nums[mid] > key[i] nums[mid] nums mid key[i] key i {
					right = mid;
				} right = mid right mid {
					left = mid + 1;
				} left = mid + 1 left mid + 1 mid 1 i++ i return count; count int[] nums nums int[] key key
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {

	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());

		String[] ss = br.readLine().split(" ");

		int[] S = new int[n];

		for (int i = 0; i < n; i++) {
			S[i] = Integer.parseInt(ss[i]);
		}

		int q = Integer.parseInt(br.readLine());

		String[] qq = br.readLine().split(" ");

		int[] Q = new int[q];

		for (int i = 0; i < q; i++) {
			Q[i] = Integer.parseInt(qq[i]);
		}

		System.out.println(binarySearch(S, Q));

	}

	static int binarySearch(int[] nums, int[] key) {

		int i = 0;

		int count = 0;

		while (i != key.length) {

			int left = 0;

			int right = nums.length;

			while (left < right) {

				int mid = (left + right) / 2;

				if (nums[mid] == key[i]) {
					count++;
					break;
				} else if (nums[mid] > key[i]) {
					right = mid;
				} else {
					left = mid + 1;
				}
			}
			i++;

		}

		return count;

	}

}