import java.io.*;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int n=Integer.parseInt(br.readLine());
        String[] str=br.readLine().split(" ");
        int[] S=new int[n];
        
        for(int i=0;i<n;i++)
            S[i]=Integer.parseInt(str[i]);
         
        int q=Integer.parseInt(br.readLine());
        str=br.readLine().split(" ");
        boolean con;
        int count=0;
        for(int i=0;i<q;i++)
            {con=false;
        	con=method(S,Integer.parseInt(str[i]));
            if(con)count++;}
        System.out.println(count);
         
        
         
 
    }
    static boolean method(int[] s,int t){
                        
        int count=0;
        int q=s.length/4;
        
        	if(t>s[q*2]){
        		if(t>s[q*3]){
            		for(int j=s[q*3];j<s.length;j++)
            			if(t==s[j]){count++;break;}}
            	else if(t<s[q*3]){
            		for(int j=q*2;j<q*3;j++)if(t==s[j]){count++;break;}}
            	else if(s[q*3]==t){count++;}}
        	
        	else if(t<s[q*2]){
        		if(t>s[q]){
            		for(int j=s[q+1];j<q*2;j++)
            			if(t==s[j]){count++;break;}}
            	else if(t<s[q]){
            		for(int j=0;j<q;j++)if(t==s[j]){count++;break;}}
            	else if(s[q]==t){count++;}}
        	
        		
        	else if(s[s.length/2]==t){count++;}
        		
        	
        
        
                 
        return count==1;
    }
 
} import java.io.*; io.* java public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int n=Integer.parseInt(br.readLine());
        String[] str=br.readLine().split(" ");
        int[] S=new int[n];
        
        for(int i=0;i<n;i++)
            S[i]=Integer.parseInt(str[i]);
         
        int q=Integer.parseInt(br.readLine());
        str=br.readLine().split(" ");
        boolean con;
        int count=0;
        for(int i=0;i<q;i++)
            {con=false;
        	con=method(S,Integer.parseInt(str[i]));
            if(con)count++;}
        System.out.println(count);
         
        
         
 
    }
    static boolean method(int[] s,int t){
                        
        int count=0;
        int q=s.length/4;
        
        	if(t>s[q*2]){
        		if(t>s[q*3]){
            		for(int j=s[q*3];j<s.length;j++)
            			if(t==s[j]){count++;break;}}
            	else if(t<s[q*3]){
            		for(int j=q*2;j<q*3;j++)if(t==s[j]){count++;break;}}
            	else if(s[q*3]==t){count++;}}
        	
        	else if(t<s[q*2]){
        		if(t>s[q]){
            		for(int j=s[q+1];j<q*2;j++)
            			if(t==s[j]){count++;break;}}
            	else if(t<s[q]){
            		for(int j=0;j<q;j++)if(t==s[j]){count++;break;}}
            	else if(s[q]==t){count++;}}
        	
        		
        	else if(s[s.length/2]==t){count++;}
        		
        	
        
        
                 
        return count==1;
    }
 
} Main public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int n=Integer.parseInt(br.readLine());
        String[] str=br.readLine().split(" ");
        int[] S=new int[n];
        
        for(int i=0;i<n;i++)
            S[i]=Integer.parseInt(str[i]);
         
        int q=Integer.parseInt(br.readLine());
        str=br.readLine().split(" ");
        boolean con;
        int count=0;
        for(int i=0;i<q;i++)
            {con=false;
        	con=method(S,Integer.parseInt(str[i]));
            if(con)count++;}
        System.out.println(count);
         
        
         
 
    } main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int n=Integer.parseInt(br.readLine());
        String[] str=br.readLine().split(" ");
        int[] S=new int[n];
        
        for(int i=0;i<n;i++)
            S[i]=Integer.parseInt(str[i]);
         
        int q=Integer.parseInt(br.readLine());
        str=br.readLine().split(" ");
        boolean con;
        int count=0;
        for(int i=0;i<q;i++)
            {con=false;
        	con=method(S,Integer.parseInt(str[i]));
            if(con)count++;}
        System.out.println(count);
         
        
         
 
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int n=Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br String[] str=br.readLine().split(" "); str br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int[] S=new int[n]; S new int[n] n for(int i=0;i<n;i++)
            S[i]=Integer.parseInt(str[i]); int i=0; int i=0; i 0 i<n i n i++ i++ i S[i]=Integer.parseInt(str[i]); S[i]=Integer.parseInt(str[i]) S[i] S i Integer.parseInt(str[i]) Integer.parseInt Integer str[i] str i int q=Integer.parseInt(br.readLine()); q Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br str=br.readLine().split(" ") str br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " boolean con; con int count=0; count 0 for(int i=0;i<q;i++)
            {con=false;
        	con=method(S,Integer.parseInt(str[i]));
            if(con)count++;} int i=0; int i=0; i 0 i<q i q i++ i++ i {con=false;
        	con=method(S,Integer.parseInt(str[i]));
            if(con)count++;} {con=false;
        	con=method(S,Integer.parseInt(str[i]));
            if(con)count++;} con=false con false con=method(S,Integer.parseInt(str[i])) con method(S,Integer.parseInt(str[i])) method S Integer.parseInt(str[i]) Integer.parseInt Integer str[i] str i if(con)count++; con count++ count System.out.println(count) System.out.println System.out System System.out count String[] args args static boolean method(int[] s,int t){
                        
        int count=0;
        int q=s.length/4;
        
        	if(t>s[q*2]){
        		if(t>s[q*3]){
            		for(int j=s[q*3];j<s.length;j++)
            			if(t==s[j]){count++;break;}}
            	else if(t<s[q*3]){
            		for(int j=q*2;j<q*3;j++)if(t==s[j]){count++;break;}}
            	else if(s[q*3]==t){count++;}}
        	
        	else if(t<s[q*2]){
        		if(t>s[q]){
            		for(int j=s[q+1];j<q*2;j++)
            			if(t==s[j]){count++;break;}}
            	else if(t<s[q]){
            		for(int j=0;j<q;j++)if(t==s[j]){count++;break;}}
            	else if(s[q]==t){count++;}}
        	
        		
        	else if(s[s.length/2]==t){count++;}
        		
        	
        
        
                 
        return count==1;
    } method {
                        
        int count=0;
        int q=s.length/4;
        
        	if(t>s[q*2]){
        		if(t>s[q*3]){
            		for(int j=s[q*3];j<s.length;j++)
            			if(t==s[j]){count++;break;}}
            	else if(t<s[q*3]){
            		for(int j=q*2;j<q*3;j++)if(t==s[j]){count++;break;}}
            	else if(s[q*3]==t){count++;}}
        	
        	else if(t<s[q*2]){
        		if(t>s[q]){
            		for(int j=s[q+1];j<q*2;j++)
            			if(t==s[j]){count++;break;}}
            	else if(t<s[q]){
            		for(int j=0;j<q;j++)if(t==s[j]){count++;break;}}
            	else if(s[q]==t){count++;}}
        	
        		
        	else if(s[s.length/2]==t){count++;}
        		
        	
        
        
                 
        return count==1;
    } int count=0; count 0 int q=s.length/4; q s.length/4 s.length s s.length 4 if(t>s[q*2]){
        		if(t>s[q*3]){
            		for(int j=s[q*3];j<s.length;j++)
            			if(t==s[j]){count++;break;}}
            	else if(t<s[q*3]){
            		for(int j=q*2;j<q*3;j++)if(t==s[j]){count++;break;}}
            	else if(s[q*3]==t){count++;}}
        	
        	else if(t<s[q*2]){
        		if(t>s[q]){
            		for(int j=s[q+1];j<q*2;j++)
            			if(t==s[j]){count++;break;}}
            	else if(t<s[q]){
            		for(int j=0;j<q;j++)if(t==s[j]){count++;break;}}
            	else if(s[q]==t){count++;}}
        	
        		
        	else if(s[s.length/2]==t){count++;} t>s[q*2] t s[q*2] s q*2 q 2 {
        		if(t>s[q*3]){
            		for(int j=s[q*3];j<s.length;j++)
            			if(t==s[j]){count++;break;}}
            	else if(t<s[q*3]){
            		for(int j=q*2;j<q*3;j++)if(t==s[j]){count++;break;}}
            	else if(s[q*3]==t){count++;}} if(t>s[q*3]){
            		for(int j=s[q*3];j<s.length;j++)
            			if(t==s[j]){count++;break;}}
            	else if(t<s[q*3]){
            		for(int j=q*2;j<q*3;j++)if(t==s[j]){count++;break;}}
            	else if(s[q*3]==t){count++;} t>s[q*3] t s[q*3] s q*3 q 3 {
            		for(int j=s[q*3];j<s.length;j++)
            			if(t==s[j]){count++;break;}} for(int j=s[q*3];j<s.length;j++)
            			if(t==s[j]){count++;break;} int j=s[q*3]; int j=s[q*3]; j s[q*3] s q*3 q 3 j<s.length j s.length s s.length j++ j++ j if(t==s[j]){count++;break;} if(t==s[j]){count++;break;} t==s[j] t s[j] s j {count++;break;} count++ count break; if(t<s[q*3]){
            		for(int j=q*2;j<q*3;j++)if(t==s[j]){count++;break;}}
            	else if(s[q*3]==t){count++;} t<s[q*3] t s[q*3] s q*3 q 3 {
            		for(int j=q*2;j<q*3;j++)if(t==s[j]){count++;break;}} for(int j=q*2;j<q*3;j++)if(t==s[j]){count++;break;} int j=q*2; int j=q*2; j q*2 q 2 j<q*3 j q*3 q 3 j++ j++ j if(t==s[j]){count++;break;} if(t==s[j]){count++;break;} t==s[j] t s[j] s j {count++;break;} count++ count break; if(s[q*3]==t){count++;} s[q*3]==t s[q*3] s q*3 q 3 t {count++;} count++ count if(t<s[q*2]){
        		if(t>s[q]){
            		for(int j=s[q+1];j<q*2;j++)
            			if(t==s[j]){count++;break;}}
            	else if(t<s[q]){
            		for(int j=0;j<q;j++)if(t==s[j]){count++;break;}}
            	else if(s[q]==t){count++;}}
        	
        		
        	else if(s[s.length/2]==t){count++;} t<s[q*2] t s[q*2] s q*2 q 2 {
        		if(t>s[q]){
            		for(int j=s[q+1];j<q*2;j++)
            			if(t==s[j]){count++;break;}}
            	else if(t<s[q]){
            		for(int j=0;j<q;j++)if(t==s[j]){count++;break;}}
            	else if(s[q]==t){count++;}} if(t>s[q]){
            		for(int j=s[q+1];j<q*2;j++)
            			if(t==s[j]){count++;break;}}
            	else if(t<s[q]){
            		for(int j=0;j<q;j++)if(t==s[j]){count++;break;}}
            	else if(s[q]==t){count++;} t>s[q] t s[q] s q {
            		for(int j=s[q+1];j<q*2;j++)
            			if(t==s[j]){count++;break;}} for(int j=s[q+1];j<q*2;j++)
            			if(t==s[j]){count++;break;} int j=s[q+1]; int j=s[q+1]; j s[q+1] s q+1 q 1 j<q*2 j q*2 q 2 j++ j++ j if(t==s[j]){count++;break;} if(t==s[j]){count++;break;} t==s[j] t s[j] s j {count++;break;} count++ count break; if(t<s[q]){
            		for(int j=0;j<q;j++)if(t==s[j]){count++;break;}}
            	else if(s[q]==t){count++;} t<s[q] t s[q] s q {
            		for(int j=0;j<q;j++)if(t==s[j]){count++;break;}} for(int j=0;j<q;j++)if(t==s[j]){count++;break;} int j=0; int j=0; j 0 j<q j q j++ j++ j if(t==s[j]){count++;break;} if(t==s[j]){count++;break;} t==s[j] t s[j] s j {count++;break;} count++ count break; if(s[q]==t){count++;} s[q]==t s[q] s q t {count++;} count++ count if(s[s.length/2]==t){count++;} s[s.length/2]==t s[s.length/2] s s.length/2 s.length s s.length 2 t {count++;} count++ count return count==1; count==1 count 1 int[] s s int t t public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int n=Integer.parseInt(br.readLine());
        String[] str=br.readLine().split(" ");
        int[] S=new int[n];
        
        for(int i=0;i<n;i++)
            S[i]=Integer.parseInt(str[i]);
         
        int q=Integer.parseInt(br.readLine());
        str=br.readLine().split(" ");
        boolean con;
        int count=0;
        for(int i=0;i<q;i++)
            {con=false;
        	con=method(S,Integer.parseInt(str[i]));
            if(con)count++;}
        System.out.println(count);
         
        
         
 
    }
    static boolean method(int[] s,int t){
                        
        int count=0;
        int q=s.length/4;
        
        	if(t>s[q*2]){
        		if(t>s[q*3]){
            		for(int j=s[q*3];j<s.length;j++)
            			if(t==s[j]){count++;break;}}
            	else if(t<s[q*3]){
            		for(int j=q*2;j<q*3;j++)if(t==s[j]){count++;break;}}
            	else if(s[q*3]==t){count++;}}
        	
        	else if(t<s[q*2]){
        		if(t>s[q]){
            		for(int j=s[q+1];j<q*2;j++)
            			if(t==s[j]){count++;break;}}
            	else if(t<s[q]){
            		for(int j=0;j<q;j++)if(t==s[j]){count++;break;}}
            	else if(s[q]==t){count++;}}
        	
        		
        	else if(s[s.length/2]==t){count++;}
        		
        	
        
        
                 
        return count==1;
    }
 
} public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int n=Integer.parseInt(br.readLine());
        String[] str=br.readLine().split(" ");
        int[] S=new int[n];
        
        for(int i=0;i<n;i++)
            S[i]=Integer.parseInt(str[i]);
         
        int q=Integer.parseInt(br.readLine());
        str=br.readLine().split(" ");
        boolean con;
        int count=0;
        for(int i=0;i<q;i++)
            {con=false;
        	con=method(S,Integer.parseInt(str[i]));
            if(con)count++;}
        System.out.println(count);
         
        
         
 
    }
    static boolean method(int[] s,int t){
                        
        int count=0;
        int q=s.length/4;
        
        	if(t>s[q*2]){
        		if(t>s[q*3]){
            		for(int j=s[q*3];j<s.length;j++)
            			if(t==s[j]){count++;break;}}
            	else if(t<s[q*3]){
            		for(int j=q*2;j<q*3;j++)if(t==s[j]){count++;break;}}
            	else if(s[q*3]==t){count++;}}
        	
        	else if(t<s[q*2]){
        		if(t>s[q]){
            		for(int j=s[q+1];j<q*2;j++)
            			if(t==s[j]){count++;break;}}
            	else if(t<s[q]){
            		for(int j=0;j<q;j++)if(t==s[j]){count++;break;}}
            	else if(s[q]==t){count++;}}
        	
        		
        	else if(s[s.length/2]==t){count++;}
        		
        	
        
        
                 
        return count==1;
    }
 
} Main
import java.io.*;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int n=Integer.parseInt(br.readLine());
        String[] str=br.readLine().split(" ");
        int[] S=new int[n];
        
        for(int i=0;i<n;i++)
            S[i]=Integer.parseInt(str[i]);
         
        int q=Integer.parseInt(br.readLine());
        str=br.readLine().split(" ");
        boolean con;
        int count=0;
        for(int i=0;i<q;i++)
            {con=false;
        	con=method(S,Integer.parseInt(str[i]));
            if(con)count++;}
        System.out.println(count);
         
        
         
 
    }
    static boolean method(int[] s,int t){
                        
        int count=0;
        int q=s.length/4;
        
        	if(t>s[q*2]){
        		if(t>s[q*3]){
            		for(int j=s[q*3];j<s.length;j++)
            			if(t==s[j]){count++;break;}}
            	else if(t<s[q*3]){
            		for(int j=q*2;j<q*3;j++)if(t==s[j]){count++;break;}}
            	else if(s[q*3]==t){count++;}}
        	
        	else if(t<s[q*2]){
        		if(t>s[q]){
            		for(int j=s[q+1];j<q*2;j++)
            			if(t==s[j]){count++;break;}}
            	else if(t<s[q]){
            		for(int j=0;j<q;j++)if(t==s[j]){count++;break;}}
            	else if(s[q]==t){count++;}}
        	
        		
        	else if(s[s.length/2]==t){count++;}
        		
        	
        
        
                 
        return count==1;
    }
 
}