import java.util.Arrays;
import java.util.Scanner;
public class Main {
	
	static boolean search(int[] S,int a,int b,int target){
		if(a<=b){
			if(S[(a+b)/2]==target){
				return true;
			}else if(S[(a+b)/2]<target){
				return search(S,((a+b)/2)+1,b,target);
			}else{
				return search(S,a,((a+b)/2)-1,target);
			}
		}else{
			return false;
		}
	}
	
	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();
		}
		Arrays.sort(S);
		int q=scan.nextInt();
		int count=0;
		int x;
		for(int i=0;i<q;i++){
			x=scan.nextInt();
			if(search(S,0,n-1,x)){
				count++;
			}
		}
		System.out.println(count);
		scan.close();
	}

} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
	
	static boolean search(int[] S,int a,int b,int target){
		if(a<=b){
			if(S[(a+b)/2]==target){
				return true;
			}else if(S[(a+b)/2]<target){
				return search(S,((a+b)/2)+1,b,target);
			}else{
				return search(S,a,((a+b)/2)-1,target);
			}
		}else{
			return false;
		}
	}
	
	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();
		}
		Arrays.sort(S);
		int q=scan.nextInt();
		int count=0;
		int x;
		for(int i=0;i<q;i++){
			x=scan.nextInt();
			if(search(S,0,n-1,x)){
				count++;
			}
		}
		System.out.println(count);
		scan.close();
	}

} Main static boolean search(int[] S,int a,int b,int target){
		if(a<=b){
			if(S[(a+b)/2]==target){
				return true;
			}else if(S[(a+b)/2]<target){
				return search(S,((a+b)/2)+1,b,target);
			}else{
				return search(S,a,((a+b)/2)-1,target);
			}
		}else{
			return false;
		}
	} search {
		if(a<=b){
			if(S[(a+b)/2]==target){
				return true;
			}else if(S[(a+b)/2]<target){
				return search(S,((a+b)/2)+1,b,target);
			}else{
				return search(S,a,((a+b)/2)-1,target);
			}
		}else{
			return false;
		}
	} if(a<=b){
			if(S[(a+b)/2]==target){
				return true;
			}else if(S[(a+b)/2]<target){
				return search(S,((a+b)/2)+1,b,target);
			}else{
				return search(S,a,((a+b)/2)-1,target);
			}
		}else{
			return false;
		} a<=b a b {
			if(S[(a+b)/2]==target){
				return true;
			}else if(S[(a+b)/2]<target){
				return search(S,((a+b)/2)+1,b,target);
			}else{
				return search(S,a,((a+b)/2)-1,target);
			}
		} if(S[(a+b)/2]==target){
				return true;
			}else if(S[(a+b)/2]<target){
				return search(S,((a+b)/2)+1,b,target);
			}else{
				return search(S,a,((a+b)/2)-1,target);
			} S[(a+b)/2]==target S[(a+b)/2] S (a+b)/2 (a+b) a b 2 target {
				return true;
			} return true; true if(S[(a+b)/2]<target){
				return search(S,((a+b)/2)+1,b,target);
			}else{
				return search(S,a,((a+b)/2)-1,target);
			} S[(a+b)/2]<target S[(a+b)/2] S (a+b)/2 (a+b) a b 2 target {
				return search(S,((a+b)/2)+1,b,target);
			} return search(S,((a+b)/2)+1,b,target); search(S,((a+b)/2)+1,b,target) search S ((a+b)/2)+1 ((a+b)/2) (a+b) a b 2 1 b target {
				return search(S,a,((a+b)/2)-1,target);
			} return search(S,a,((a+b)/2)-1,target); search(S,a,((a+b)/2)-1,target) search S a ((a+b)/2)-1 ((a+b)/2) (a+b) a b 2 1 target {
			return false;
		} return false; false int[] S S int a a int b b int target target 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();
		}
		Arrays.sort(S);
		int q=scan.nextInt();
		int count=0;
		int x;
		for(int i=0;i<q;i++){
			x=scan.nextInt();
			if(search(S,0,n-1,x)){
				count++;
			}
		}
		System.out.println(count);
		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();
		}
		Arrays.sort(S);
		int q=scan.nextInt();
		int count=0;
		int x;
		for(int i=0;i<q;i++){
			x=scan.nextInt();
			if(search(S,0,n-1,x)){
				count++;
			}
		}
		System.out.println(count);
		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 Arrays.sort(S) Arrays.sort Arrays S int q=scan.nextInt(); q scan.nextInt() scan.nextInt scan int count=0; count 0 int x; x for(int i=0;i<q;i++){
			x=scan.nextInt();
			if(search(S,0,n-1,x)){
				count++;
			}
		} int i=0; int i=0; i 0 i<q i q i++ i++ i {
			x=scan.nextInt();
			if(search(S,0,n-1,x)){
				count++;
			}
		} {
			x=scan.nextInt();
			if(search(S,0,n-1,x)){
				count++;
			}
		} x=scan.nextInt() x scan.nextInt() scan.nextInt scan if(search(S,0,n-1,x)){
				count++;
			} search(S,0,n-1,x) search S 0 n-1 n 1 x {
				count++;
			} count++ count System.out.println(count) System.out.println System.out System System.out count scan.close() scan.close scan String[] args args public class Main {
	
	static boolean search(int[] S,int a,int b,int target){
		if(a<=b){
			if(S[(a+b)/2]==target){
				return true;
			}else if(S[(a+b)/2]<target){
				return search(S,((a+b)/2)+1,b,target);
			}else{
				return search(S,a,((a+b)/2)-1,target);
			}
		}else{
			return false;
		}
	}
	
	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();
		}
		Arrays.sort(S);
		int q=scan.nextInt();
		int count=0;
		int x;
		for(int i=0;i<q;i++){
			x=scan.nextInt();
			if(search(S,0,n-1,x)){
				count++;
			}
		}
		System.out.println(count);
		scan.close();
	}

} public class Main {
	
	static boolean search(int[] S,int a,int b,int target){
		if(a<=b){
			if(S[(a+b)/2]==target){
				return true;
			}else if(S[(a+b)/2]<target){
				return search(S,((a+b)/2)+1,b,target);
			}else{
				return search(S,a,((a+b)/2)-1,target);
			}
		}else{
			return false;
		}
	}
	
	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();
		}
		Arrays.sort(S);
		int q=scan.nextInt();
		int count=0;
		int x;
		for(int i=0;i<q;i++){
			x=scan.nextInt();
			if(search(S,0,n-1,x)){
				count++;
			}
		}
		System.out.println(count);
		scan.close();
	}

} Main
import java.util.Arrays;
import java.util.Scanner;
public class Main {
	
	static boolean search(int[] S,int a,int b,int target){
		if(a<=b){
			if(S[(a+b)/2]==target){
				return true;
			}else if(S[(a+b)/2]<target){
				return search(S,((a+b)/2)+1,b,target);
			}else{
				return search(S,a,((a+b)/2)-1,target);
			}
		}else{
			return false;
		}
	}
	
	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();
		}
		Arrays.sort(S);
		int q=scan.nextInt();
		int count=0;
		int x;
		for(int i=0;i<q;i++){
			x=scan.nextInt();
			if(search(S,0,n-1,x)){
				count++;
			}
		}
		System.out.println(count);
		scan.close();
	}

}