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

public class Main {

	static int n, q;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		int[] S = new int[n];
		for(int i = 0 ; i < n ; i++) S[i] = sc.nextInt();
		q = sc.nextInt();
		int[] T = new int[q];
		for(int i = 0 ; i < q ; i++) T[i] = sc.nextInt();
		Arrays.sort(S);

		long ans = 0;
		for(int i = 0 ; i < q ; i++) {
			if(binary_search(T[i], S)) ans++;
		}
		System.out.println(ans);
	}

	public static boolean binary_search(int x, int[] S) {
		int l = 0;
		int r = n;
		while(r > l) {
			int center = (l + r) / 2;
			if(x == S[center]) return true;
			else if(x > S[center]) l = center + 1;
			else r = center;
		}
		return false;
	}

} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {

	static int n, q;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		int[] S = new int[n];
		for(int i = 0 ; i < n ; i++) S[i] = sc.nextInt();
		q = sc.nextInt();
		int[] T = new int[q];
		for(int i = 0 ; i < q ; i++) T[i] = sc.nextInt();
		Arrays.sort(S);

		long ans = 0;
		for(int i = 0 ; i < q ; i++) {
			if(binary_search(T[i], S)) ans++;
		}
		System.out.println(ans);
	}

	public static boolean binary_search(int x, int[] S) {
		int l = 0;
		int r = n;
		while(r > l) {
			int center = (l + r) / 2;
			if(x == S[center]) return true;
			else if(x > S[center]) l = center + 1;
			else r = center;
		}
		return false;
	}

} Main static int n n q; q public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		int[] S = new int[n];
		for(int i = 0 ; i < n ; i++) S[i] = sc.nextInt();
		q = sc.nextInt();
		int[] T = new int[q];
		for(int i = 0 ; i < q ; i++) T[i] = sc.nextInt();
		Arrays.sort(S);

		long ans = 0;
		for(int i = 0 ; i < q ; i++) {
			if(binary_search(T[i], S)) ans++;
		}
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		int[] S = new int[n];
		for(int i = 0 ; i < n ; i++) S[i] = sc.nextInt();
		q = sc.nextInt();
		int[] T = new int[q];
		for(int i = 0 ; i < q ; i++) T[i] = sc.nextInt();
		Arrays.sort(S);

		long ans = 0;
		for(int i = 0 ; i < q ; i++) {
			if(binary_search(T[i], S)) ans++;
		}
		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) 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] S i sc.nextInt() sc.nextInt sc q = sc.nextInt() q sc.nextInt() sc.nextInt sc int[] T = new int[q]; T new int[q] q for(int i = 0 ; i < q ; i++) T[i] = sc.nextInt(); int i = 0 ; int i = 0 ; i 0 i < q i q i++ i++ i T[i] = sc.nextInt(); T[i] = sc.nextInt() T[i] T i sc.nextInt() sc.nextInt sc Arrays.sort(S) Arrays.sort Arrays S long ans = 0; ans 0 for(int i = 0 ; i < q ; i++) {
			if(binary_search(T[i], S)) ans++;
		} int i = 0 ; int i = 0 ; i 0 i < q i q i++ i++ i {
			if(binary_search(T[i], S)) ans++;
		} {
			if(binary_search(T[i], S)) ans++;
		} if(binary_search(T[i], S)) ans++; binary_search(T[i], S) binary_search T[i] T i S ans++ ans System.out.println(ans) System.out.println System.out System System.out ans String[] args args public static boolean binary_search(int x, int[] S) {
		int l = 0;
		int r = n;
		while(r > l) {
			int center = (l + r) / 2;
			if(x == S[center]) return true;
			else if(x > S[center]) l = center + 1;
			else r = center;
		}
		return false;
	} binary_search {
		int l = 0;
		int r = n;
		while(r > l) {
			int center = (l + r) / 2;
			if(x == S[center]) return true;
			else if(x > S[center]) l = center + 1;
			else r = center;
		}
		return false;
	} int l = 0; l 0 int r = n; r n while(r > l) {
			int center = (l + r) / 2;
			if(x == S[center]) return true;
			else if(x > S[center]) l = center + 1;
			else r = center;
		} r > l r l {
			int center = (l + r) / 2;
			if(x == S[center]) return true;
			else if(x > S[center]) l = center + 1;
			else r = center;
		} int center = (l + r) / 2; center (l + r) / 2 (l + r) l r 2 if(x == S[center]) return true;
			else if(x > S[center]) l = center + 1;
			else r = center; x == S[center] x S[center] S center return true; true if(x > S[center]) l = center + 1;
			else r = center; x > S[center] x S[center] S center l = center + 1 l center + 1 center 1 r = center r center return false; false int x x int[] S S public class Main {

	static int n, q;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		int[] S = new int[n];
		for(int i = 0 ; i < n ; i++) S[i] = sc.nextInt();
		q = sc.nextInt();
		int[] T = new int[q];
		for(int i = 0 ; i < q ; i++) T[i] = sc.nextInt();
		Arrays.sort(S);

		long ans = 0;
		for(int i = 0 ; i < q ; i++) {
			if(binary_search(T[i], S)) ans++;
		}
		System.out.println(ans);
	}

	public static boolean binary_search(int x, int[] S) {
		int l = 0;
		int r = n;
		while(r > l) {
			int center = (l + r) / 2;
			if(x == S[center]) return true;
			else if(x > S[center]) l = center + 1;
			else r = center;
		}
		return false;
	}

} public class Main {

	static int n, q;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		int[] S = new int[n];
		for(int i = 0 ; i < n ; i++) S[i] = sc.nextInt();
		q = sc.nextInt();
		int[] T = new int[q];
		for(int i = 0 ; i < q ; i++) T[i] = sc.nextInt();
		Arrays.sort(S);

		long ans = 0;
		for(int i = 0 ; i < q ; i++) {
			if(binary_search(T[i], S)) ans++;
		}
		System.out.println(ans);
	}

	public static boolean binary_search(int x, int[] S) {
		int l = 0;
		int r = n;
		while(r > l) {
			int center = (l + r) / 2;
			if(x == S[center]) return true;
			else if(x > S[center]) l = center + 1;
			else r = center;
		}
		return false;
	}

} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	static int n, q;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		int[] S = new int[n];
		for(int i = 0 ; i < n ; i++) S[i] = sc.nextInt();
		q = sc.nextInt();
		int[] T = new int[q];
		for(int i = 0 ; i < q ; i++) T[i] = sc.nextInt();
		Arrays.sort(S);

		long ans = 0;
		for(int i = 0 ; i < q ; i++) {
			if(binary_search(T[i], S)) ans++;
		}
		System.out.println(ans);
	}

	public static boolean binary_search(int x, int[] S) {
		int l = 0;
		int r = n;
		while(r > l) {
			int center = (l + r) / 2;
			if(x == S[center]) return true;
			else if(x > S[center]) l = center + 1;
			else r = center;
		}
		return false;
	}

}