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

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int countA,countB,sum=0;
		countA = sc.nextInt();
		int[] s = new int[countA];
		for(int i=0; i<countA; i++) {
			s[i] = sc.nextInt();
		}
		countB = sc.nextInt();


		for(int i=0; i<countB; i++) {
			int tmp = sc.nextInt();
			if(Arrays.binarySearch(s, tmp) > -1)
				sum++;
		}
		System.out.println(sum);
	}
}


 import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int countA,countB,sum=0;
		countA = sc.nextInt();
		int[] s = new int[countA];
		for(int i=0; i<countA; i++) {
			s[i] = sc.nextInt();
		}
		countB = sc.nextInt();


		for(int i=0; i<countB; i++) {
			int tmp = sc.nextInt();
			if(Arrays.binarySearch(s, tmp) > -1)
				sum++;
		}
		System.out.println(sum);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int countA,countB,sum=0;
		countA = sc.nextInt();
		int[] s = new int[countA];
		for(int i=0; i<countA; i++) {
			s[i] = sc.nextInt();
		}
		countB = sc.nextInt();


		for(int i=0; i<countB; i++) {
			int tmp = sc.nextInt();
			if(Arrays.binarySearch(s, tmp) > -1)
				sum++;
		}
		System.out.println(sum);
	} main {
		Scanner sc = new Scanner(System.in);
		int countA,countB,sum=0;
		countA = sc.nextInt();
		int[] s = new int[countA];
		for(int i=0; i<countA; i++) {
			s[i] = sc.nextInt();
		}
		countB = sc.nextInt();


		for(int i=0; i<countB; i++) {
			int tmp = sc.nextInt();
			if(Arrays.binarySearch(s, tmp) > -1)
				sum++;
		}
		System.out.println(sum);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int countA countA countB countB sum=0; sum 0 countA = sc.nextInt() countA sc.nextInt() sc.nextInt sc int[] s = new int[countA]; s new int[countA] countA for(int i=0; i<countA; i++) {
			s[i] = sc.nextInt();
		} int i=0; int i=0; i 0 i<countA i countA i++ i++ i {
			s[i] = sc.nextInt();
		} {
			s[i] = sc.nextInt();
		} s[i] = sc.nextInt() s[i] s i sc.nextInt() sc.nextInt sc countB = sc.nextInt() countB sc.nextInt() sc.nextInt sc for(int i=0; i<countB; i++) {
			int tmp = sc.nextInt();
			if(Arrays.binarySearch(s, tmp) > -1)
				sum++;
		} int i=0; int i=0; i 0 i<countB i countB i++ i++ i {
			int tmp = sc.nextInt();
			if(Arrays.binarySearch(s, tmp) > -1)
				sum++;
		} {
			int tmp = sc.nextInt();
			if(Arrays.binarySearch(s, tmp) > -1)
				sum++;
		} int tmp = sc.nextInt(); tmp sc.nextInt() sc.nextInt sc if(Arrays.binarySearch(s, tmp) > -1)
				sum++; Arrays.binarySearch(s, tmp) > -1 Arrays.binarySearch(s, tmp) Arrays.binarySearch Arrays s tmp -1 1 sum++ sum System.out.println(sum) System.out.println System.out System System.out sum String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int countA,countB,sum=0;
		countA = sc.nextInt();
		int[] s = new int[countA];
		for(int i=0; i<countA; i++) {
			s[i] = sc.nextInt();
		}
		countB = sc.nextInt();


		for(int i=0; i<countB; i++) {
			int tmp = sc.nextInt();
			if(Arrays.binarySearch(s, tmp) > -1)
				sum++;
		}
		System.out.println(sum);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int countA,countB,sum=0;
		countA = sc.nextInt();
		int[] s = new int[countA];
		for(int i=0; i<countA; i++) {
			s[i] = sc.nextInt();
		}
		countB = sc.nextInt();


		for(int i=0; i<countB; i++) {
			int tmp = sc.nextInt();
			if(Arrays.binarySearch(s, tmp) > -1)
				sum++;
		}
		System.out.println(sum);
	}
} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int countA,countB,sum=0;
		countA = sc.nextInt();
		int[] s = new int[countA];
		for(int i=0; i<countA; i++) {
			s[i] = sc.nextInt();
		}
		countB = sc.nextInt();


		for(int i=0; i<countB; i++) {
			int tmp = sc.nextInt();
			if(Arrays.binarySearch(s, tmp) > -1)
				sum++;
		}
		System.out.println(sum);
	}
}



