import java.util.Scanner;

// ALDS1_4_B
public class Main {
	boolean binarySearch(int[] array, int target, int min, int max) {
		if (max < min) return false;
		int mid = (max + min) / 2;
		if (array[mid] > target) return binarySearch(array, target, min, mid - 1);
		if (array[mid] < target) return binarySearch(array, target, mid + 1, max);
		return true;
	}
	
	void run() {
		int count = 0;
		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();
		for (int i = 0; i < q; i++) {
			if (binarySearch(S, sc.nextInt(), 0, S.length - 1)) count++;
		}
		System.out.println(count);
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}
 import java.util.Scanner; Scanner java.util public class Main {
	boolean binarySearch(int[] array, int target, int min, int max) {
		if (max < min) return false;
		int mid = (max + min) / 2;
		if (array[mid] > target) return binarySearch(array, target, min, mid - 1);
		if (array[mid] < target) return binarySearch(array, target, mid + 1, max);
		return true;
	}
	
	void run() {
		int count = 0;
		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();
		for (int i = 0; i < q; i++) {
			if (binarySearch(S, sc.nextInt(), 0, S.length - 1)) count++;
		}
		System.out.println(count);
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
} Main boolean binarySearch(int[] array, int target, int min, int max) {
		if (max < min) return false;
		int mid = (max + min) / 2;
		if (array[mid] > target) return binarySearch(array, target, min, mid - 1);
		if (array[mid] < target) return binarySearch(array, target, mid + 1, max);
		return true;
	} binarySearch {
		if (max < min) return false;
		int mid = (max + min) / 2;
		if (array[mid] > target) return binarySearch(array, target, min, mid - 1);
		if (array[mid] < target) return binarySearch(array, target, mid + 1, max);
		return true;
	} if (max < min) return false; max < min max min return false; false int mid = (max + min) / 2; mid (max + min) / 2 (max + min) max min 2 if (array[mid] > target) return binarySearch(array, target, min, mid - 1); array[mid] > target array[mid] array mid target return binarySearch(array, target, min, mid - 1); binarySearch(array, target, min, mid - 1) binarySearch array target min mid - 1 mid 1 if (array[mid] < target) return binarySearch(array, target, mid + 1, max); array[mid] < target array[mid] array mid target return binarySearch(array, target, mid + 1, max); binarySearch(array, target, mid + 1, max) binarySearch array target mid + 1 mid 1 max return true; true int[] array array int target target int min min int max max void run() {
		int count = 0;
		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();
		for (int i = 0; i < q; i++) {
			if (binarySearch(S, sc.nextInt(), 0, S.length - 1)) count++;
		}
		System.out.println(count);
	} run {
		int count = 0;
		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();
		for (int i = 0; i < q; i++) {
			if (binarySearch(S, sc.nextInt(), 0, S.length - 1)) count++;
		}
		System.out.println(count);
	} int count = 0; count 0 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 for (int i = 0; i < q; i++) {
			if (binarySearch(S, sc.nextInt(), 0, S.length - 1)) count++;
		} int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
			if (binarySearch(S, sc.nextInt(), 0, S.length - 1)) count++;
		} {
			if (binarySearch(S, sc.nextInt(), 0, S.length - 1)) count++;
		} if (binarySearch(S, sc.nextInt(), 0, S.length - 1)) count++; binarySearch(S, sc.nextInt(), 0, S.length - 1) binarySearch S sc.nextInt() sc.nextInt sc 0 S.length - 1 S.length S S.length 1 count++ count System.out.println(count) System.out.println System.out System System.out count 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 {
	boolean binarySearch(int[] array, int target, int min, int max) {
		if (max < min) return false;
		int mid = (max + min) / 2;
		if (array[mid] > target) return binarySearch(array, target, min, mid - 1);
		if (array[mid] < target) return binarySearch(array, target, mid + 1, max);
		return true;
	}
	
	void run() {
		int count = 0;
		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();
		for (int i = 0; i < q; i++) {
			if (binarySearch(S, sc.nextInt(), 0, S.length - 1)) count++;
		}
		System.out.println(count);
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
} public class Main {
	boolean binarySearch(int[] array, int target, int min, int max) {
		if (max < min) return false;
		int mid = (max + min) / 2;
		if (array[mid] > target) return binarySearch(array, target, min, mid - 1);
		if (array[mid] < target) return binarySearch(array, target, mid + 1, max);
		return true;
	}
	
	void run() {
		int count = 0;
		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();
		for (int i = 0; i < q; i++) {
			if (binarySearch(S, sc.nextInt(), 0, S.length - 1)) count++;
		}
		System.out.println(count);
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
} Main
import java.util.Scanner;

// ALDS1_4_B
public class Main {
	boolean binarySearch(int[] array, int target, int min, int max) {
		if (max < min) return false;
		int mid = (max + min) / 2;
		if (array[mid] > target) return binarySearch(array, target, min, mid - 1);
		if (array[mid] < target) return binarySearch(array, target, mid + 1, max);
		return true;
	}
	
	void run() {
		int count = 0;
		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();
		for (int i = 0; i < q; i++) {
			if (binarySearch(S, sc.nextInt(), 0, S.length - 1)) count++;
		}
		System.out.println(count);
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

