import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

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();
		}

		Set<Integer> C = new HashSet<Integer>();


		for (int i = 0; i < q; i++) {
			int head = 0;
			int tail = n - 1;

			while(head <= tail) {
				int center = (head + tail) / 2;
				if(S[center] == T[i]){
					C.add(i);
					break;
				} else if (S[center] < T[i]) {
					head = center + 1;
				} else {
					tail = center - 1;
				}
			}
		}

		Integer[] afterC = C.toArray(new Integer[0]);
		System.out.println(afterC.length);

		scan.close();
	}

}
 import java.util.HashSet; HashSet java.util import java.util.Scanner; Scanner java.util import java.util.Set; Set 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();
		}

		Set<Integer> C = new HashSet<Integer>();


		for (int i = 0; i < q; i++) {
			int head = 0;
			int tail = n - 1;

			while(head <= tail) {
				int center = (head + tail) / 2;
				if(S[center] == T[i]){
					C.add(i);
					break;
				} else if (S[center] < T[i]) {
					head = center + 1;
				} else {
					tail = center - 1;
				}
			}
		}

		Integer[] afterC = C.toArray(new Integer[0]);
		System.out.println(afterC.length);

		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();
		}

		Set<Integer> C = new HashSet<Integer>();


		for (int i = 0; i < q; i++) {
			int head = 0;
			int tail = n - 1;

			while(head <= tail) {
				int center = (head + tail) / 2;
				if(S[center] == T[i]){
					C.add(i);
					break;
				} else if (S[center] < T[i]) {
					head = center + 1;
				} else {
					tail = center - 1;
				}
			}
		}

		Integer[] afterC = C.toArray(new Integer[0]);
		System.out.println(afterC.length);

		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();
		}

		Set<Integer> C = new HashSet<Integer>();


		for (int i = 0; i < q; i++) {
			int head = 0;
			int tail = n - 1;

			while(head <= tail) {
				int center = (head + tail) / 2;
				if(S[center] == T[i]){
					C.add(i);
					break;
				} else if (S[center] < T[i]) {
					head = center + 1;
				} else {
					tail = center - 1;
				}
			}
		}

		Integer[] afterC = C.toArray(new Integer[0]);
		System.out.println(afterC.length);

		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 Set<Integer> C = new HashSet<Integer>(); C new HashSet<Integer>() for (int i = 0; i < q; i++) {
			int head = 0;
			int tail = n - 1;

			while(head <= tail) {
				int center = (head + tail) / 2;
				if(S[center] == T[i]){
					C.add(i);
					break;
				} else if (S[center] < T[i]) {
					head = center + 1;
				} else {
					tail = center - 1;
				}
			}
		} int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
			int head = 0;
			int tail = n - 1;

			while(head <= tail) {
				int center = (head + tail) / 2;
				if(S[center] == T[i]){
					C.add(i);
					break;
				} else if (S[center] < T[i]) {
					head = center + 1;
				} else {
					tail = center - 1;
				}
			}
		} {
			int head = 0;
			int tail = n - 1;

			while(head <= tail) {
				int center = (head + tail) / 2;
				if(S[center] == T[i]){
					C.add(i);
					break;
				} else if (S[center] < T[i]) {
					head = center + 1;
				} else {
					tail = center - 1;
				}
			}
		} int head = 0; head 0 int tail = n - 1; tail n - 1 n 1 while(head <= tail) {
				int center = (head + tail) / 2;
				if(S[center] == T[i]){
					C.add(i);
					break;
				} else if (S[center] < T[i]) {
					head = center + 1;
				} else {
					tail = center - 1;
				}
			} head <= tail head tail {
				int center = (head + tail) / 2;
				if(S[center] == T[i]){
					C.add(i);
					break;
				} else if (S[center] < T[i]) {
					head = center + 1;
				} else {
					tail = center - 1;
				}
			} int center = (head + tail) / 2; center (head + tail) / 2 (head + tail) head tail 2 if(S[center] == T[i]){
					C.add(i);
					break;
				} else if (S[center] < T[i]) {
					head = center + 1;
				} else {
					tail = center - 1;
				} S[center] == T[i] S[center] S center T[i] T i {
					C.add(i);
					break;
				} C.add(i) C.add C i break; if (S[center] < T[i]) {
					head = center + 1;
				} else {
					tail = center - 1;
				} S[center] < T[i] S[center] S center T[i] T i {
					head = center + 1;
				} head = center + 1 head center + 1 center 1 {
					tail = center - 1;
				} tail = center - 1 tail center - 1 center 1 Integer[] afterC = C.toArray(new Integer[0]); afterC C.toArray(new Integer[0]) C.toArray C new Integer[0] 0 System.out.println(afterC.length) System.out.println System.out System System.out afterC.length afterC afterC.length 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();
		}

		Set<Integer> C = new HashSet<Integer>();


		for (int i = 0; i < q; i++) {
			int head = 0;
			int tail = n - 1;

			while(head <= tail) {
				int center = (head + tail) / 2;
				if(S[center] == T[i]){
					C.add(i);
					break;
				} else if (S[center] < T[i]) {
					head = center + 1;
				} else {
					tail = center - 1;
				}
			}
		}

		Integer[] afterC = C.toArray(new Integer[0]);
		System.out.println(afterC.length);

		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();
		}

		Set<Integer> C = new HashSet<Integer>();


		for (int i = 0; i < q; i++) {
			int head = 0;
			int tail = n - 1;

			while(head <= tail) {
				int center = (head + tail) / 2;
				if(S[center] == T[i]){
					C.add(i);
					break;
				} else if (S[center] < T[i]) {
					head = center + 1;
				} else {
					tail = center - 1;
				}
			}
		}

		Integer[] afterC = C.toArray(new Integer[0]);
		System.out.println(afterC.length);

		scan.close();
	}

} Main
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

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();
		}

		Set<Integer> C = new HashSet<Integer>();


		for (int i = 0; i < q; i++) {
			int head = 0;
			int tail = n - 1;

			while(head <= tail) {
				int center = (head + tail) / 2;
				if(S[center] == T[i]){
					C.add(i);
					break;
				} else if (S[center] < T[i]) {
					head = center + 1;
				} else {
					tail = center - 1;
				}
			}
		}

		Integer[] afterC = C.toArray(new Integer[0]);
		System.out.println(afterC.length);

		scan.close();
	}

}

