import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);

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

		int q = stdIn.nextInt();
		int[] T = new int[q];
		for (int i=0; i<q; i++) {
			T[i] = stdIn.nextInt();
		}
		
		Arrays.sort(S);
		Arrays.sort(T);

		int count = 0;
		for (int i=0; i<q; i++) {
			if(Arrays.binarySearch(S,T[i]) >= 0)
				count++;
		}

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

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

		int q = stdIn.nextInt();
		int[] T = new int[q];
		for (int i=0; i<q; i++) {
			T[i] = stdIn.nextInt();
		}
		
		Arrays.sort(S);
		Arrays.sort(T);

		int count = 0;
		for (int i=0; i<q; i++) {
			if(Arrays.binarySearch(S,T[i]) >= 0)
				count++;
		}

		System.out.println(count);
	}
} Main public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);

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

		int q = stdIn.nextInt();
		int[] T = new int[q];
		for (int i=0; i<q; i++) {
			T[i] = stdIn.nextInt();
		}
		
		Arrays.sort(S);
		Arrays.sort(T);

		int count = 0;
		for (int i=0; i<q; i++) {
			if(Arrays.binarySearch(S,T[i]) >= 0)
				count++;
		}

		System.out.println(count);
	} main {
		Scanner stdIn = new Scanner(System.in);

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

		int q = stdIn.nextInt();
		int[] T = new int[q];
		for (int i=0; i<q; i++) {
			T[i] = stdIn.nextInt();
		}
		
		Arrays.sort(S);
		Arrays.sort(T);

		int count = 0;
		for (int i=0; i<q; i++) {
			if(Arrays.binarySearch(S,T[i]) >= 0)
				count++;
		}

		System.out.println(count);
	} Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) int n = stdIn.nextInt(); n stdIn.nextInt() stdIn.nextInt stdIn int[] S = new int[n]; S new int[n] n for (int i=0; i<n; i++) {
			S[i] = stdIn.nextInt();
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			S[i] = stdIn.nextInt();
		} {
			S[i] = stdIn.nextInt();
		} S[i] = stdIn.nextInt() S[i] S i stdIn.nextInt() stdIn.nextInt stdIn int q = stdIn.nextInt(); q stdIn.nextInt() stdIn.nextInt stdIn int[] T = new int[q]; T new int[q] q for (int i=0; i<q; i++) {
			T[i] = stdIn.nextInt();
		} int i=0; int i=0; i 0 i<q i q i++ i++ i {
			T[i] = stdIn.nextInt();
		} {
			T[i] = stdIn.nextInt();
		} T[i] = stdIn.nextInt() T[i] T i stdIn.nextInt() stdIn.nextInt stdIn Arrays.sort(S) Arrays.sort Arrays S Arrays.sort(T) Arrays.sort Arrays T int count = 0; count 0 for (int i=0; i<q; i++) {
			if(Arrays.binarySearch(S,T[i]) >= 0)
				count++;
		} int i=0; int i=0; i 0 i<q i q i++ i++ i {
			if(Arrays.binarySearch(S,T[i]) >= 0)
				count++;
		} {
			if(Arrays.binarySearch(S,T[i]) >= 0)
				count++;
		} if(Arrays.binarySearch(S,T[i]) >= 0)
				count++; Arrays.binarySearch(S,T[i]) >= 0 Arrays.binarySearch(S,T[i]) Arrays.binarySearch Arrays S T[i] T i 0 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 stdIn = new Scanner(System.in);

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

		int q = stdIn.nextInt();
		int[] T = new int[q];
		for (int i=0; i<q; i++) {
			T[i] = stdIn.nextInt();
		}
		
		Arrays.sort(S);
		Arrays.sort(T);

		int count = 0;
		for (int i=0; i<q; i++) {
			if(Arrays.binarySearch(S,T[i]) >= 0)
				count++;
		}

		System.out.println(count);
	}
}