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


public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		int n = scan.nextInt();
		int[] S = new int[n];
		for (int i = 0; i < n; i++) {
			S[i] = scan.nextInt();
		}
		int q = scan.nextInt();
		int[] 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 (Arrays.binarySearch(S, T[i]) >= 0) {
				ans++;
			}
		}
		
		System.out.println(ans);
		
		scan.close();
		
	}

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

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		int n = scan.nextInt();
		int[] S = new int[n];
		for (int i = 0; i < n; i++) {
			S[i] = scan.nextInt();
		}
		int q = scan.nextInt();
		int[] 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 (Arrays.binarySearch(S, T[i]) >= 0) {
				ans++;
			}
		}
		
		System.out.println(ans);
		
		scan.close();
		
	}

} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		int n = scan.nextInt();
		int[] S = new int[n];
		for (int i = 0; i < n; i++) {
			S[i] = scan.nextInt();
		}
		int q = scan.nextInt();
		int[] 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 (Arrays.binarySearch(S, T[i]) >= 0) {
				ans++;
			}
		}
		
		System.out.println(ans);
		
		scan.close();
		
	} main {
		Scanner scan = new Scanner(System.in);
		
		int n = scan.nextInt();
		int[] S = new int[n];
		for (int i = 0; i < n; i++) {
			S[i] = scan.nextInt();
		}
		int q = scan.nextInt();
		int[] 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 (Arrays.binarySearch(S, T[i]) >= 0) {
				ans++;
			}
		}
		
		System.out.println(ans);
		
		scan.close();
		
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int[] 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] = scan.nextInt() S[i] S i scan.nextInt() scan.nextInt scan int q = scan.nextInt(); q scan.nextInt() scan.nextInt scan int[] 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] = scan.nextInt() T[i] T i scan.nextInt() scan.nextInt scan int ans = 0; ans 0 for (int i = 0; i < q; i++) {
			if (Arrays.binarySearch(S, T[i]) >= 0) {
				ans++;
			}
		} int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
			if (Arrays.binarySearch(S, T[i]) >= 0) {
				ans++;
			}
		} {
			if (Arrays.binarySearch(S, T[i]) >= 0) {
				ans++;
			}
		} if (Arrays.binarySearch(S, T[i]) >= 0) {
				ans++;
			} Arrays.binarySearch(S, T[i]) >= 0 Arrays.binarySearch(S, T[i]) Arrays.binarySearch Arrays S T[i] T i 0 {
				ans++;
			} ans++ ans System.out.println(ans) System.out.println System.out System System.out ans scan.close() scan.close scan String[] args args public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		int n = scan.nextInt();
		int[] S = new int[n];
		for (int i = 0; i < n; i++) {
			S[i] = scan.nextInt();
		}
		int q = scan.nextInt();
		int[] 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 (Arrays.binarySearch(S, T[i]) >= 0) {
				ans++;
			}
		}
		
		System.out.println(ans);
		
		scan.close();
		
	}

} public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		int n = scan.nextInt();
		int[] S = new int[n];
		for (int i = 0; i < n; i++) {
			S[i] = scan.nextInt();
		}
		int q = scan.nextInt();
		int[] 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 (Arrays.binarySearch(S, T[i]) >= 0) {
				ans++;
			}
		}
		
		System.out.println(ans);
		
		scan.close();
		
	}

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


public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		int n = scan.nextInt();
		int[] S = new int[n];
		for (int i = 0; i < n; i++) {
			S[i] = scan.nextInt();
		}
		int q = scan.nextInt();
		int[] 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 (Arrays.binarySearch(S, T[i]) >= 0) {
				ans++;
			}
		}
		
		System.out.println(ans);
		
		scan.close();
		
	}

}