import java.util.Scanner;


public class Main{

	public static void main(String args[]){
		int i,j,n,h;
		Scanner sc=new Scanner(System.in);
		n=Integer.parseInt(sc.next());
		int s[]=new int[n+1];
		for(i=0;i<n;i++){
			s[i]=Integer.parseInt(sc.next());
			
		}
		
		
		
		int q=Integer.parseInt(sc.next());
		int t[]=new int[q+1];
		
		for(i=0;i<q;i++){
			t[i]=Integer.parseInt(sc.next());
		}
		
		int count=0;

		
		for(i=0;i<q;i++){
			int a=0,b=n;
			
	
			while(a<b){
				h=(a+b)/2;
				if (t[i] == s[h]){
					count++;
					break;
				} 
				if (t[i]<s[h])
					
					b = h;
				else 
					a = h+1;	
				
			}
			
		}
		
		
		System.out.println(count);		
	}
}


/*int n,k;
Scanner sc=new Scanner(System.in);
n=Integer.parseInt();
int tr[]=new int[n+1];*/ import java.util.Scanner; Scanner java.util public class Main{

	public static void main(String args[]){
		int i,j,n,h;
		Scanner sc=new Scanner(System.in);
		n=Integer.parseInt(sc.next());
		int s[]=new int[n+1];
		for(i=0;i<n;i++){
			s[i]=Integer.parseInt(sc.next());
			
		}
		
		
		
		int q=Integer.parseInt(sc.next());
		int t[]=new int[q+1];
		
		for(i=0;i<q;i++){
			t[i]=Integer.parseInt(sc.next());
		}
		
		int count=0;

		
		for(i=0;i<q;i++){
			int a=0,b=n;
			
	
			while(a<b){
				h=(a+b)/2;
				if (t[i] == s[h]){
					count++;
					break;
				} 
				if (t[i]<s[h])
					
					b = h;
				else 
					a = h+1;	
				
			}
			
		}
		
		
		System.out.println(count);		
	}
} Main public static void main(String args[]){
		int i,j,n,h;
		Scanner sc=new Scanner(System.in);
		n=Integer.parseInt(sc.next());
		int s[]=new int[n+1];
		for(i=0;i<n;i++){
			s[i]=Integer.parseInt(sc.next());
			
		}
		
		
		
		int q=Integer.parseInt(sc.next());
		int t[]=new int[q+1];
		
		for(i=0;i<q;i++){
			t[i]=Integer.parseInt(sc.next());
		}
		
		int count=0;

		
		for(i=0;i<q;i++){
			int a=0,b=n;
			
	
			while(a<b){
				h=(a+b)/2;
				if (t[i] == s[h]){
					count++;
					break;
				} 
				if (t[i]<s[h])
					
					b = h;
				else 
					a = h+1;	
				
			}
			
		}
		
		
		System.out.println(count);		
	} main {
		int i,j,n,h;
		Scanner sc=new Scanner(System.in);
		n=Integer.parseInt(sc.next());
		int s[]=new int[n+1];
		for(i=0;i<n;i++){
			s[i]=Integer.parseInt(sc.next());
			
		}
		
		
		
		int q=Integer.parseInt(sc.next());
		int t[]=new int[q+1];
		
		for(i=0;i<q;i++){
			t[i]=Integer.parseInt(sc.next());
		}
		
		int count=0;

		
		for(i=0;i<q;i++){
			int a=0,b=n;
			
	
			while(a<b){
				h=(a+b)/2;
				if (t[i] == s[h]){
					count++;
					break;
				} 
				if (t[i]<s[h])
					
					b = h;
				else 
					a = h+1;	
				
			}
			
		}
		
		
		System.out.println(count);		
	} int i i j j n n h; h Scanner sc=new Scanner(System.in); sc new Scanner(System.in) n=Integer.parseInt(sc.next()) n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int s[]=new int[n+1]; s new int[n+1] n+1 n 1 for(i=0;i<n;i++){
			s[i]=Integer.parseInt(sc.next());
			
		} i=0; i=0 i 0 i<n i n i++ i++ i {
			s[i]=Integer.parseInt(sc.next());
			
		} {
			s[i]=Integer.parseInt(sc.next());
			
		} s[i]=Integer.parseInt(sc.next()) s[i] s i Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int q=Integer.parseInt(sc.next()); q Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int t[]=new int[q+1]; t new int[q+1] q+1 q 1 for(i=0;i<q;i++){
			t[i]=Integer.parseInt(sc.next());
		} i=0; i=0 i 0 i<q i q i++ i++ i {
			t[i]=Integer.parseInt(sc.next());
		} {
			t[i]=Integer.parseInt(sc.next());
		} t[i]=Integer.parseInt(sc.next()) t[i] t i Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int count=0; count 0 for(i=0;i<q;i++){
			int a=0,b=n;
			
	
			while(a<b){
				h=(a+b)/2;
				if (t[i] == s[h]){
					count++;
					break;
				} 
				if (t[i]<s[h])
					
					b = h;
				else 
					a = h+1;	
				
			}
			
		} i=0; i=0 i 0 i<q i q i++ i++ i {
			int a=0,b=n;
			
	
			while(a<b){
				h=(a+b)/2;
				if (t[i] == s[h]){
					count++;
					break;
				} 
				if (t[i]<s[h])
					
					b = h;
				else 
					a = h+1;	
				
			}
			
		} {
			int a=0,b=n;
			
	
			while(a<b){
				h=(a+b)/2;
				if (t[i] == s[h]){
					count++;
					break;
				} 
				if (t[i]<s[h])
					
					b = h;
				else 
					a = h+1;	
				
			}
			
		} int a=0 a 0 b=n; b n while(a<b){
				h=(a+b)/2;
				if (t[i] == s[h]){
					count++;
					break;
				} 
				if (t[i]<s[h])
					
					b = h;
				else 
					a = h+1;	
				
			} a<b a b {
				h=(a+b)/2;
				if (t[i] == s[h]){
					count++;
					break;
				} 
				if (t[i]<s[h])
					
					b = h;
				else 
					a = h+1;	
				
			} h=(a+b)/2 h (a+b)/2 (a+b) a b 2 if (t[i] == s[h]){
					count++;
					break;
				} t[i] == s[h] t[i] t i s[h] s h {
					count++;
					break;
				} count++ count break; if (t[i]<s[h])
					
					b = h;
				else 
					a = h+1; t[i]<s[h] t[i] t i s[h] s h b = h b h a = h+1 a h+1 h 1 System.out.println(count) System.out.println System.out System System.out count String args[] args public class Main{

	public static void main(String args[]){
		int i,j,n,h;
		Scanner sc=new Scanner(System.in);
		n=Integer.parseInt(sc.next());
		int s[]=new int[n+1];
		for(i=0;i<n;i++){
			s[i]=Integer.parseInt(sc.next());
			
		}
		
		
		
		int q=Integer.parseInt(sc.next());
		int t[]=new int[q+1];
		
		for(i=0;i<q;i++){
			t[i]=Integer.parseInt(sc.next());
		}
		
		int count=0;

		
		for(i=0;i<q;i++){
			int a=0,b=n;
			
	
			while(a<b){
				h=(a+b)/2;
				if (t[i] == s[h]){
					count++;
					break;
				} 
				if (t[i]<s[h])
					
					b = h;
				else 
					a = h+1;	
				
			}
			
		}
		
		
		System.out.println(count);		
	}
} public class Main{

	public static void main(String args[]){
		int i,j,n,h;
		Scanner sc=new Scanner(System.in);
		n=Integer.parseInt(sc.next());
		int s[]=new int[n+1];
		for(i=0;i<n;i++){
			s[i]=Integer.parseInt(sc.next());
			
		}
		
		
		
		int q=Integer.parseInt(sc.next());
		int t[]=new int[q+1];
		
		for(i=0;i<q;i++){
			t[i]=Integer.parseInt(sc.next());
		}
		
		int count=0;

		
		for(i=0;i<q;i++){
			int a=0,b=n;
			
	
			while(a<b){
				h=(a+b)/2;
				if (t[i] == s[h]){
					count++;
					break;
				} 
				if (t[i]<s[h])
					
					b = h;
				else 
					a = h+1;	
				
			}
			
		}
		
		
		System.out.println(count);		
	}
} Main
import java.util.Scanner;


public class Main{

	public static void main(String args[]){
		int i,j,n,h;
		Scanner sc=new Scanner(System.in);
		n=Integer.parseInt(sc.next());
		int s[]=new int[n+1];
		for(i=0;i<n;i++){
			s[i]=Integer.parseInt(sc.next());
			
		}
		
		
		
		int q=Integer.parseInt(sc.next());
		int t[]=new int[q+1];
		
		for(i=0;i<q;i++){
			t[i]=Integer.parseInt(sc.next());
		}
		
		int count=0;

		
		for(i=0;i<q;i++){
			int a=0,b=n;
			
	
			while(a<b){
				h=(a+b)/2;
				if (t[i] == s[h]){
					count++;
					break;
				} 
				if (t[i]<s[h])
					
					b = h;
				else 
					a = h+1;	
				
			}
			
		}
		
		
		System.out.println(count);		
	}
}


/*int n,k;
Scanner sc=new Scanner(System.in);
n=Integer.parseInt();
int tr[]=new int[n+1];*/