import java.util.*;
class  Main{
	Scanner sc= new Scanner(System.in);
	void aaaa(){
		int gundam=0;
		int n=sc.nextInt();
		int[] N=new int[n];
		for(int i=0;i<n;i++)N[i]=sc.nextInt();
		int q=sc.nextInt();
		for(int i=0;i<q;i++){
			int Q=sc.nextInt();
			int L=0;
			int R=n-1;
			while(N[L]<=Q&&Q<=N[R]){
				int cent=(L+R)/2;
				if(N[cent]==Q){
					gundam++;
					break;
				}else if(N[cent]>Q)R=cent-1;
				else L=cent+1;
			}
		}
		System.out.println(gundam);
	}
	public static void main(String[]args){
		new Main().aaaa();
	}
} import java.util.*; util.* java class  Main{
	Scanner sc= new Scanner(System.in);
	void aaaa(){
		int gundam=0;
		int n=sc.nextInt();
		int[] N=new int[n];
		for(int i=0;i<n;i++)N[i]=sc.nextInt();
		int q=sc.nextInt();
		for(int i=0;i<q;i++){
			int Q=sc.nextInt();
			int L=0;
			int R=n-1;
			while(N[L]<=Q&&Q<=N[R]){
				int cent=(L+R)/2;
				if(N[cent]==Q){
					gundam++;
					break;
				}else if(N[cent]>Q)R=cent-1;
				else L=cent+1;
			}
		}
		System.out.println(gundam);
	}
	public static void main(String[]args){
		new Main().aaaa();
	}
} Main Scanner sc= new Scanner(System.in); sc new Scanner(System.in) void aaaa(){
		int gundam=0;
		int n=sc.nextInt();
		int[] N=new int[n];
		for(int i=0;i<n;i++)N[i]=sc.nextInt();
		int q=sc.nextInt();
		for(int i=0;i<q;i++){
			int Q=sc.nextInt();
			int L=0;
			int R=n-1;
			while(N[L]<=Q&&Q<=N[R]){
				int cent=(L+R)/2;
				if(N[cent]==Q){
					gundam++;
					break;
				}else if(N[cent]>Q)R=cent-1;
				else L=cent+1;
			}
		}
		System.out.println(gundam);
	} aaaa {
		int gundam=0;
		int n=sc.nextInt();
		int[] N=new int[n];
		for(int i=0;i<n;i++)N[i]=sc.nextInt();
		int q=sc.nextInt();
		for(int i=0;i<q;i++){
			int Q=sc.nextInt();
			int L=0;
			int R=n-1;
			while(N[L]<=Q&&Q<=N[R]){
				int cent=(L+R)/2;
				if(N[cent]==Q){
					gundam++;
					break;
				}else if(N[cent]>Q)R=cent-1;
				else L=cent+1;
			}
		}
		System.out.println(gundam);
	} int gundam=0; gundam 0 int n=sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] N=new int[n]; N new int[n] n for(int i=0;i<n;i++)N[i]=sc.nextInt(); int i=0; int i=0; i 0 i<n i n i++ i++ i N[i]=sc.nextInt(); N[i]=sc.nextInt() N[i] N i sc.nextInt() sc.nextInt sc int q=sc.nextInt(); q sc.nextInt() sc.nextInt sc for(int i=0;i<q;i++){
			int Q=sc.nextInt();
			int L=0;
			int R=n-1;
			while(N[L]<=Q&&Q<=N[R]){
				int cent=(L+R)/2;
				if(N[cent]==Q){
					gundam++;
					break;
				}else if(N[cent]>Q)R=cent-1;
				else L=cent+1;
			}
		} int i=0; int i=0; i 0 i<q i q i++ i++ i {
			int Q=sc.nextInt();
			int L=0;
			int R=n-1;
			while(N[L]<=Q&&Q<=N[R]){
				int cent=(L+R)/2;
				if(N[cent]==Q){
					gundam++;
					break;
				}else if(N[cent]>Q)R=cent-1;
				else L=cent+1;
			}
		} {
			int Q=sc.nextInt();
			int L=0;
			int R=n-1;
			while(N[L]<=Q&&Q<=N[R]){
				int cent=(L+R)/2;
				if(N[cent]==Q){
					gundam++;
					break;
				}else if(N[cent]>Q)R=cent-1;
				else L=cent+1;
			}
		} int Q=sc.nextInt(); Q sc.nextInt() sc.nextInt sc int L=0; L 0 int R=n-1; R n-1 n 1 while(N[L]<=Q&&Q<=N[R]){
				int cent=(L+R)/2;
				if(N[cent]==Q){
					gundam++;
					break;
				}else if(N[cent]>Q)R=cent-1;
				else L=cent+1;
			} N[L]<=Q&&Q<=N[R] N[L]<=Q N[L] N L Q Q<=N[R] Q N[R] N R {
				int cent=(L+R)/2;
				if(N[cent]==Q){
					gundam++;
					break;
				}else if(N[cent]>Q)R=cent-1;
				else L=cent+1;
			} int cent=(L+R)/2; cent (L+R)/2 (L+R) L R 2 if(N[cent]==Q){
					gundam++;
					break;
				}else if(N[cent]>Q)R=cent-1;
				else L=cent+1; N[cent]==Q N[cent] N cent Q {
					gundam++;
					break;
				} gundam++ gundam break; if(N[cent]>Q)R=cent-1;
				else L=cent+1; N[cent]>Q N[cent] N cent Q R=cent-1 R cent-1 cent 1 L=cent+1 L cent+1 cent 1 System.out.println(gundam) System.out.println System.out System System.out gundam public static void main(String[]args){
		new Main().aaaa();
	} main {
		new Main().aaaa();
	} new Main().aaaa() new Main().aaaa new Main() String[]args args
import java.util.*;
class  Main{
	Scanner sc= new Scanner(System.in);
	void aaaa(){
		int gundam=0;
		int n=sc.nextInt();
		int[] N=new int[n];
		for(int i=0;i<n;i++)N[i]=sc.nextInt();
		int q=sc.nextInt();
		for(int i=0;i<q;i++){
			int Q=sc.nextInt();
			int L=0;
			int R=n-1;
			while(N[L]<=Q&&Q<=N[R]){
				int cent=(L+R)/2;
				if(N[cent]==Q){
					gundam++;
					break;
				}else if(N[cent]>Q)R=cent-1;
				else L=cent+1;
			}
		}
		System.out.println(gundam);
	}
	public static void main(String[]args){
		new Main().aaaa();
	}
}