import java.util.*;
import java.io.*;
class Main{
    public static void main(String args[]){
	int r,l,m,n,q,i,j,count=0;
	int s[] = new int[1000000];
	int t[] = new int[1000000];
	Scanner scan = new Scanner(System.in);
	
	n = scan.nextInt();
	for(i=0;i<n;i++){
	    s[i] = scan.nextInt();
	}
	q = scan.nextInt();
	for(j=0;j<q;j++){
	    t[j] = scan.nextInt();
	}
	
	for(j=0;j<q;j++){
	    r = n;
	    l = 0;
	    m = n/2;
	    while(true){
		if(s[m]==t[j]){count++;break;}
		if(m==l){break;} 
		if(s[m]>t[j]){/*探す値が左側にあった場合*/
		    r = m;
		    m = (r+l)/2;
		}
		if(s[m]<t[j]){/*探す値が右側にあった場合*/
		    l = m+1;
		    m = (r+l)/2;
		}
		}
	}
	System.out.println(count);
    }
}
 import java.util.*; util.* java import java.io.*; io.* java class Main{
    public static void main(String args[]){
	int r,l,m,n,q,i,j,count=0;
	int s[] = new int[1000000];
	int t[] = new int[1000000];
	Scanner scan = new Scanner(System.in);
	
	n = scan.nextInt();
	for(i=0;i<n;i++){
	    s[i] = scan.nextInt();
	}
	q = scan.nextInt();
	for(j=0;j<q;j++){
	    t[j] = scan.nextInt();
	}
	
	for(j=0;j<q;j++){
	    r = n;
	    l = 0;
	    m = n/2;
	    while(true){
		if(s[m]==t[j]){count++;break;}
		if(m==l){break;} 
		if(s[m]>t[j]){/*探す値が左側にあった場合*/
		    r = m;
		    m = (r+l)/2;
		}
		if(s[m]<t[j]){/*探す値が右側にあった場合*/
		    l = m+1;
		    m = (r+l)/2;
		}
		}
	}
	System.out.println(count);
    }
} Main public static void main(String args[]){
	int r,l,m,n,q,i,j,count=0;
	int s[] = new int[1000000];
	int t[] = new int[1000000];
	Scanner scan = new Scanner(System.in);
	
	n = scan.nextInt();
	for(i=0;i<n;i++){
	    s[i] = scan.nextInt();
	}
	q = scan.nextInt();
	for(j=0;j<q;j++){
	    t[j] = scan.nextInt();
	}
	
	for(j=0;j<q;j++){
	    r = n;
	    l = 0;
	    m = n/2;
	    while(true){
		if(s[m]==t[j]){count++;break;}
		if(m==l){break;} 
		if(s[m]>t[j]){/*探す値が左側にあった場合*/
		    r = m;
		    m = (r+l)/2;
		}
		if(s[m]<t[j]){/*探す値が右側にあった場合*/
		    l = m+1;
		    m = (r+l)/2;
		}
		}
	}
	System.out.println(count);
    } main {
	int r,l,m,n,q,i,j,count=0;
	int s[] = new int[1000000];
	int t[] = new int[1000000];
	Scanner scan = new Scanner(System.in);
	
	n = scan.nextInt();
	for(i=0;i<n;i++){
	    s[i] = scan.nextInt();
	}
	q = scan.nextInt();
	for(j=0;j<q;j++){
	    t[j] = scan.nextInt();
	}
	
	for(j=0;j<q;j++){
	    r = n;
	    l = 0;
	    m = n/2;
	    while(true){
		if(s[m]==t[j]){count++;break;}
		if(m==l){break;} 
		if(s[m]>t[j]){/*探す値が左側にあった場合*/
		    r = m;
		    m = (r+l)/2;
		}
		if(s[m]<t[j]){/*探す値が右側にあった場合*/
		    l = m+1;
		    m = (r+l)/2;
		}
		}
	}
	System.out.println(count);
    } int r r l l m m n n q q i i j j count=0; count 0 int s[] = new int[1000000]; s new int[1000000] 1000000 int t[] = new int[1000000]; t new int[1000000] 1000000 Scanner scan = new Scanner(System.in); scan new Scanner(System.in) n = scan.nextInt() n scan.nextInt() scan.nextInt scan for(i=0;i<n;i++){
	    s[i] = scan.nextInt();
	} i=0; 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 q = scan.nextInt() q scan.nextInt() scan.nextInt scan for(j=0;j<q;j++){
	    t[j] = scan.nextInt();
	} j=0; j=0 j 0 j<q j q j++ j++ j {
	    t[j] = scan.nextInt();
	} {
	    t[j] = scan.nextInt();
	} t[j] = scan.nextInt() t[j] t j scan.nextInt() scan.nextInt scan for(j=0;j<q;j++){
	    r = n;
	    l = 0;
	    m = n/2;
	    while(true){
		if(s[m]==t[j]){count++;break;}
		if(m==l){break;} 
		if(s[m]>t[j]){/*探す値が左側にあった場合*/
		    r = m;
		    m = (r+l)/2;
		}
		if(s[m]<t[j]){/*探す値が右側にあった場合*/
		    l = m+1;
		    m = (r+l)/2;
		}
		}
	} j=0; j=0 j 0 j<q j q j++ j++ j {
	    r = n;
	    l = 0;
	    m = n/2;
	    while(true){
		if(s[m]==t[j]){count++;break;}
		if(m==l){break;} 
		if(s[m]>t[j]){/*探す値が左側にあった場合*/
		    r = m;
		    m = (r+l)/2;
		}
		if(s[m]<t[j]){/*探す値が右側にあった場合*/
		    l = m+1;
		    m = (r+l)/2;
		}
		}
	} {
	    r = n;
	    l = 0;
	    m = n/2;
	    while(true){
		if(s[m]==t[j]){count++;break;}
		if(m==l){break;} 
		if(s[m]>t[j]){/*探す値が左側にあった場合*/
		    r = m;
		    m = (r+l)/2;
		}
		if(s[m]<t[j]){/*探す値が右側にあった場合*/
		    l = m+1;
		    m = (r+l)/2;
		}
		}
	} r = n r n l = 0 l 0 m = n/2 m n/2 n 2 while(true){
		if(s[m]==t[j]){count++;break;}
		if(m==l){break;} 
		if(s[m]>t[j]){/*探す値が左側にあった場合*/
		    r = m;
		    m = (r+l)/2;
		}
		if(s[m]<t[j]){/*探す値が右側にあった場合*/
		    l = m+1;
		    m = (r+l)/2;
		}
		} true {
		if(s[m]==t[j]){count++;break;}
		if(m==l){break;} 
		if(s[m]>t[j]){/*探す値が左側にあった場合*/
		    r = m;
		    m = (r+l)/2;
		}
		if(s[m]<t[j]){/*探す値が右側にあった場合*/
		    l = m+1;
		    m = (r+l)/2;
		}
		} if(s[m]==t[j]){count++;break;} s[m]==t[j] s[m] s m t[j] t j {count++;break;} count++ count break; if(m==l){break;} m==l m l {break;} break; if(s[m]>t[j]){/*探す値が左側にあった場合*/
		    r = m;
		    m = (r+l)/2;
		} s[m]>t[j] s[m] s m t[j] t j {/*探す値が左側にあった場合*/
		    r = m;
		    m = (r+l)/2;
		} r = m r m m = (r+l)/2 m (r+l)/2 (r+l) r l 2 if(s[m]<t[j]){/*探す値が右側にあった場合*/
		    l = m+1;
		    m = (r+l)/2;
		} s[m]<t[j] s[m] s m t[j] t j {/*探す値が右側にあった場合*/
		    l = m+1;
		    m = (r+l)/2;
		} l = m+1 l m+1 m 1 m = (r+l)/2 m (r+l)/2 (r+l) r l 2 System.out.println(count) System.out.println System.out System System.out count String args[] args
import java.util.*;
import java.io.*;
class Main{
    public static void main(String args[]){
	int r,l,m,n,q,i,j,count=0;
	int s[] = new int[1000000];
	int t[] = new int[1000000];
	Scanner scan = new Scanner(System.in);
	
	n = scan.nextInt();
	for(i=0;i<n;i++){
	    s[i] = scan.nextInt();
	}
	q = scan.nextInt();
	for(j=0;j<q;j++){
	    t[j] = scan.nextInt();
	}
	
	for(j=0;j<q;j++){
	    r = n;
	    l = 0;
	    m = n/2;
	    while(true){
		if(s[m]==t[j]){count++;break;}
		if(m==l){break;} 
		if(s[m]>t[j]){/*探す値が左側にあった場合*/
		    r = m;
		    m = (r+l)/2;
		}
		if(s[m]<t[j]){/*探す値が右側にあった場合*/
		    l = m+1;
		    m = (r+l)/2;
		}
		}
	}
	System.out.println(count);
    }
}

