import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n, tmp, count = 0;

		n = sc.nextInt();
		int[] nums = new int[n];
		for (int i = 0; i < n; i++) {
			nums[i] = sc.nextInt();
		}

		n = sc.nextInt();
		for (int i = 0; i < n; i++) {
			tmp = sc.nextInt();
			if (Arrays.binarySearch(nums, tmp) >= 0) {
				count++;
			}
		}

		System.out.println(count);
	}
} import java.util.*; util.* java class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n, tmp, count = 0;

		n = sc.nextInt();
		int[] nums = new int[n];
		for (int i = 0; i < n; i++) {
			nums[i] = sc.nextInt();
		}

		n = sc.nextInt();
		for (int i = 0; i < n; i++) {
			tmp = sc.nextInt();
			if (Arrays.binarySearch(nums, tmp) >= 0) {
				count++;
			}
		}

		System.out.println(count);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n, tmp, count = 0;

		n = sc.nextInt();
		int[] nums = new int[n];
		for (int i = 0; i < n; i++) {
			nums[i] = sc.nextInt();
		}

		n = sc.nextInt();
		for (int i = 0; i < n; i++) {
			tmp = sc.nextInt();
			if (Arrays.binarySearch(nums, tmp) >= 0) {
				count++;
			}
		}

		System.out.println(count);
	} main {
		Scanner sc = new Scanner(System.in);
		int n, tmp, count = 0;

		n = sc.nextInt();
		int[] nums = new int[n];
		for (int i = 0; i < n; i++) {
			nums[i] = sc.nextInt();
		}

		n = sc.nextInt();
		for (int i = 0; i < n; i++) {
			tmp = sc.nextInt();
			if (Arrays.binarySearch(nums, tmp) >= 0) {
				count++;
			}
		}

		System.out.println(count);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n n tmp tmp count = 0; count 0 n = sc.nextInt() n sc.nextInt() sc.nextInt sc int[] nums = new int[n]; nums new int[n] n for (int i = 0; i < n; i++) {
			nums[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			nums[i] = sc.nextInt();
		} {
			nums[i] = sc.nextInt();
		} nums[i] = sc.nextInt() nums[i] nums i sc.nextInt() sc.nextInt sc n = sc.nextInt() n sc.nextInt() sc.nextInt sc for (int i = 0; i < n; i++) {
			tmp = sc.nextInt();
			if (Arrays.binarySearch(nums, tmp) >= 0) {
				count++;
			}
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			tmp = sc.nextInt();
			if (Arrays.binarySearch(nums, tmp) >= 0) {
				count++;
			}
		} {
			tmp = sc.nextInt();
			if (Arrays.binarySearch(nums, tmp) >= 0) {
				count++;
			}
		} tmp = sc.nextInt() tmp sc.nextInt() sc.nextInt sc if (Arrays.binarySearch(nums, tmp) >= 0) {
				count++;
			} Arrays.binarySearch(nums, tmp) >= 0 Arrays.binarySearch(nums, tmp) Arrays.binarySearch Arrays nums tmp 0 {
				count++;
			} count++ count System.out.println(count) System.out.println System.out System System.out count String[] args args
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n, tmp, count = 0;

		n = sc.nextInt();
		int[] nums = new int[n];
		for (int i = 0; i < n; i++) {
			nums[i] = sc.nextInt();
		}

		n = sc.nextInt();
		for (int i = 0; i < n; i++) {
			tmp = sc.nextInt();
			if (Arrays.binarySearch(nums, tmp) >= 0) {
				count++;
			}
		}

		System.out.println(count);
	}
}