import java.util.Scanner;
class Main{
	Scanner sc = new Scanner(System.in);
	int n;
	int[] S;
	int q;
	int[] T;
	int C;
	int left;
	int right;
	int mid;
	void n(){
		n=sc.nextInt();
		S=new int[n];
		for(int i=0; i<n; i++){
			S[i]=sc.nextInt();
		}
		q=sc.nextInt();
		T=new int[q];
		for(int j=0; j<q; j++){
			T[j]=sc.nextInt();
		}
		
		for(int j=0; j<q; j++){
			left=0;
			right=n;
			while(left<right){
				mid=(left+right)/2;
				
				if(T[j]==S[mid]){
					C++;
					break;
				}else if(T[j]<S[mid]){
					right=mid;
				}else if(T[j]>S[mid]){
					left=mid+1;
				}
			}
		}
		System.out.println(C);
	}
	public static void main(String[]agrs){
		new Main().n();
	}
} import java.util.Scanner; Scanner java.util class Main{
	Scanner sc = new Scanner(System.in);
	int n;
	int[] S;
	int q;
	int[] T;
	int C;
	int left;
	int right;
	int mid;
	void n(){
		n=sc.nextInt();
		S=new int[n];
		for(int i=0; i<n; i++){
			S[i]=sc.nextInt();
		}
		q=sc.nextInt();
		T=new int[q];
		for(int j=0; j<q; j++){
			T[j]=sc.nextInt();
		}
		
		for(int j=0; j<q; j++){
			left=0;
			right=n;
			while(left<right){
				mid=(left+right)/2;
				
				if(T[j]==S[mid]){
					C++;
					break;
				}else if(T[j]<S[mid]){
					right=mid;
				}else if(T[j]>S[mid]){
					left=mid+1;
				}
			}
		}
		System.out.println(C);
	}
	public static void main(String[]agrs){
		new Main().n();
	}
} Main Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n; n int[] S; S int q; q int[] T; T int C; C int left; left int right; right int mid; mid void n(){
		n=sc.nextInt();
		S=new int[n];
		for(int i=0; i<n; i++){
			S[i]=sc.nextInt();
		}
		q=sc.nextInt();
		T=new int[q];
		for(int j=0; j<q; j++){
			T[j]=sc.nextInt();
		}
		
		for(int j=0; j<q; j++){
			left=0;
			right=n;
			while(left<right){
				mid=(left+right)/2;
				
				if(T[j]==S[mid]){
					C++;
					break;
				}else if(T[j]<S[mid]){
					right=mid;
				}else if(T[j]>S[mid]){
					left=mid+1;
				}
			}
		}
		System.out.println(C);
	} n {
		n=sc.nextInt();
		S=new int[n];
		for(int i=0; i<n; i++){
			S[i]=sc.nextInt();
		}
		q=sc.nextInt();
		T=new int[q];
		for(int j=0; j<q; j++){
			T[j]=sc.nextInt();
		}
		
		for(int j=0; j<q; j++){
			left=0;
			right=n;
			while(left<right){
				mid=(left+right)/2;
				
				if(T[j]==S[mid]){
					C++;
					break;
				}else if(T[j]<S[mid]){
					right=mid;
				}else if(T[j]>S[mid]){
					left=mid+1;
				}
			}
		}
		System.out.println(C);
	} n=sc.nextInt() n sc.nextInt() sc.nextInt sc S=new int[n] S new int[n] n for(int i=0; i<n; i++){
			S[i]=sc.nextInt();
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			S[i]=sc.nextInt();
		} {
			S[i]=sc.nextInt();
		} S[i]=sc.nextInt() S[i] S i sc.nextInt() sc.nextInt sc q=sc.nextInt() q sc.nextInt() sc.nextInt sc T=new int[q] T new int[q] q for(int j=0; j<q; j++){
			T[j]=sc.nextInt();
		} int j=0; int j=0; j 0 j<q j q j++ j++ j {
			T[j]=sc.nextInt();
		} {
			T[j]=sc.nextInt();
		} T[j]=sc.nextInt() T[j] T j sc.nextInt() sc.nextInt sc for(int j=0; j<q; j++){
			left=0;
			right=n;
			while(left<right){
				mid=(left+right)/2;
				
				if(T[j]==S[mid]){
					C++;
					break;
				}else if(T[j]<S[mid]){
					right=mid;
				}else if(T[j]>S[mid]){
					left=mid+1;
				}
			}
		} int j=0; int j=0; j 0 j<q j q j++ j++ j {
			left=0;
			right=n;
			while(left<right){
				mid=(left+right)/2;
				
				if(T[j]==S[mid]){
					C++;
					break;
				}else if(T[j]<S[mid]){
					right=mid;
				}else if(T[j]>S[mid]){
					left=mid+1;
				}
			}
		} {
			left=0;
			right=n;
			while(left<right){
				mid=(left+right)/2;
				
				if(T[j]==S[mid]){
					C++;
					break;
				}else if(T[j]<S[mid]){
					right=mid;
				}else if(T[j]>S[mid]){
					left=mid+1;
				}
			}
		} left=0 left 0 right=n right n while(left<right){
				mid=(left+right)/2;
				
				if(T[j]==S[mid]){
					C++;
					break;
				}else if(T[j]<S[mid]){
					right=mid;
				}else if(T[j]>S[mid]){
					left=mid+1;
				}
			} left<right left right {
				mid=(left+right)/2;
				
				if(T[j]==S[mid]){
					C++;
					break;
				}else if(T[j]<S[mid]){
					right=mid;
				}else if(T[j]>S[mid]){
					left=mid+1;
				}
			} mid=(left+right)/2 mid (left+right)/2 (left+right) left right 2 if(T[j]==S[mid]){
					C++;
					break;
				}else if(T[j]<S[mid]){
					right=mid;
				}else if(T[j]>S[mid]){
					left=mid+1;
				} T[j]==S[mid] T[j] T j S[mid] S mid {
					C++;
					break;
				} C++ C break; if(T[j]<S[mid]){
					right=mid;
				}else if(T[j]>S[mid]){
					left=mid+1;
				} T[j]<S[mid] T[j] T j S[mid] S mid {
					right=mid;
				} right=mid right mid if(T[j]>S[mid]){
					left=mid+1;
				} T[j]>S[mid] T[j] T j S[mid] S mid {
					left=mid+1;
				} left=mid+1 left mid+1 mid 1 System.out.println(C) System.out.println System.out System System.out C public static void main(String[]agrs){
		new Main().n();
	} main {
		new Main().n();
	} new Main().n() new Main().n new Main() String[]agrs agrs
import java.util.Scanner;
class Main{
	Scanner sc = new Scanner(System.in);
	int n;
	int[] S;
	int q;
	int[] T;
	int C;
	int left;
	int right;
	int mid;
	void n(){
		n=sc.nextInt();
		S=new int[n];
		for(int i=0; i<n; i++){
			S[i]=sc.nextInt();
		}
		q=sc.nextInt();
		T=new int[q];
		for(int j=0; j<q; j++){
			T[j]=sc.nextInt();
		}
		
		for(int j=0; j<q; j++){
			left=0;
			right=n;
			while(left<right){
				mid=(left+right)/2;
				
				if(T[j]==S[mid]){
					C++;
					break;
				}else if(T[j]<S[mid]){
					right=mid;
				}else if(T[j]>S[mid]){
					left=mid+1;
				}
			}
		}
		System.out.println(C);
	}
	public static void main(String[]agrs){
		new Main().n();
	}
}