import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		int i,cnt=0,big,sma,mid;
		// TODO Auto-generated method stub
   Scanner sca=new Scanner(System.in);
    int hair1[]=new int[sca.nextInt()];
    for(i=0;i<hair1.length;i++){
    	hair1[i]=sca.nextInt();
    }
    int hair2[]=new int[sca.nextInt()];
    for(i=0;i<hair2.length;i++){
    	hair2[i]=sca.nextInt();
    }
    for(i=0;i<hair2.length;i++){
    	big=hair1.length;
    	sma=0;
    	while(sma<big){
    		mid=(big+sma)/2;
    		if(hair1[mid]==hair2[i]){
    			cnt++;
    			break;
    		}
    		if(hair1[mid]>hair2[i])big=mid;
    		if(hair1[mid]<hair2[i])sma=mid+1;
    		}
    	}
    System.out.println(cnt);
	}

} import java.util.Scanner; Scanner java.util public class Main{

	public static void main(String[] args) {
		int i,cnt=0,big,sma,mid;
		// TODO Auto-generated method stub
   Scanner sca=new Scanner(System.in);
    int hair1[]=new int[sca.nextInt()];
    for(i=0;i<hair1.length;i++){
    	hair1[i]=sca.nextInt();
    }
    int hair2[]=new int[sca.nextInt()];
    for(i=0;i<hair2.length;i++){
    	hair2[i]=sca.nextInt();
    }
    for(i=0;i<hair2.length;i++){
    	big=hair1.length;
    	sma=0;
    	while(sma<big){
    		mid=(big+sma)/2;
    		if(hair1[mid]==hair2[i]){
    			cnt++;
    			break;
    		}
    		if(hair1[mid]>hair2[i])big=mid;
    		if(hair1[mid]<hair2[i])sma=mid+1;
    		}
    	}
    System.out.println(cnt);
	}

} Main public static void main(String[] args) {
		int i,cnt=0,big,sma,mid;
		// TODO Auto-generated method stub
   Scanner sca=new Scanner(System.in);
    int hair1[]=new int[sca.nextInt()];
    for(i=0;i<hair1.length;i++){
    	hair1[i]=sca.nextInt();
    }
    int hair2[]=new int[sca.nextInt()];
    for(i=0;i<hair2.length;i++){
    	hair2[i]=sca.nextInt();
    }
    for(i=0;i<hair2.length;i++){
    	big=hair1.length;
    	sma=0;
    	while(sma<big){
    		mid=(big+sma)/2;
    		if(hair1[mid]==hair2[i]){
    			cnt++;
    			break;
    		}
    		if(hair1[mid]>hair2[i])big=mid;
    		if(hair1[mid]<hair2[i])sma=mid+1;
    		}
    	}
    System.out.println(cnt);
	} main {
		int i,cnt=0,big,sma,mid;
		// TODO Auto-generated method stub
   Scanner sca=new Scanner(System.in);
    int hair1[]=new int[sca.nextInt()];
    for(i=0;i<hair1.length;i++){
    	hair1[i]=sca.nextInt();
    }
    int hair2[]=new int[sca.nextInt()];
    for(i=0;i<hair2.length;i++){
    	hair2[i]=sca.nextInt();
    }
    for(i=0;i<hair2.length;i++){
    	big=hair1.length;
    	sma=0;
    	while(sma<big){
    		mid=(big+sma)/2;
    		if(hair1[mid]==hair2[i]){
    			cnt++;
    			break;
    		}
    		if(hair1[mid]>hair2[i])big=mid;
    		if(hair1[mid]<hair2[i])sma=mid+1;
    		}
    	}
    System.out.println(cnt);
	} int i i cnt=0 cnt 0 big big sma sma mid; mid Scanner sca=new Scanner(System.in); sca new Scanner(System.in) int hair1[]=new int[sca.nextInt()]; hair1 new int[sca.nextInt()] sca.nextInt() sca.nextInt sca for(i=0;i<hair1.length;i++){
    	hair1[i]=sca.nextInt();
    } i=0; i=0 i 0 i<hair1.length i hair1.length hair1 hair1.length i++ i++ i {
    	hair1[i]=sca.nextInt();
    } {
    	hair1[i]=sca.nextInt();
    } hair1[i]=sca.nextInt() hair1[i] hair1 i sca.nextInt() sca.nextInt sca int hair2[]=new int[sca.nextInt()]; hair2 new int[sca.nextInt()] sca.nextInt() sca.nextInt sca for(i=0;i<hair2.length;i++){
    	hair2[i]=sca.nextInt();
    } i=0; i=0 i 0 i<hair2.length i hair2.length hair2 hair2.length i++ i++ i {
    	hair2[i]=sca.nextInt();
    } {
    	hair2[i]=sca.nextInt();
    } hair2[i]=sca.nextInt() hair2[i] hair2 i sca.nextInt() sca.nextInt sca for(i=0;i<hair2.length;i++){
    	big=hair1.length;
    	sma=0;
    	while(sma<big){
    		mid=(big+sma)/2;
    		if(hair1[mid]==hair2[i]){
    			cnt++;
    			break;
    		}
    		if(hair1[mid]>hair2[i])big=mid;
    		if(hair1[mid]<hair2[i])sma=mid+1;
    		}
    	} i=0; i=0 i 0 i<hair2.length i hair2.length hair2 hair2.length i++ i++ i {
    	big=hair1.length;
    	sma=0;
    	while(sma<big){
    		mid=(big+sma)/2;
    		if(hair1[mid]==hair2[i]){
    			cnt++;
    			break;
    		}
    		if(hair1[mid]>hair2[i])big=mid;
    		if(hair1[mid]<hair2[i])sma=mid+1;
    		}
    	} {
    	big=hair1.length;
    	sma=0;
    	while(sma<big){
    		mid=(big+sma)/2;
    		if(hair1[mid]==hair2[i]){
    			cnt++;
    			break;
    		}
    		if(hair1[mid]>hair2[i])big=mid;
    		if(hair1[mid]<hair2[i])sma=mid+1;
    		}
    	} big=hair1.length big hair1.length hair1 hair1.length sma=0 sma 0 while(sma<big){
    		mid=(big+sma)/2;
    		if(hair1[mid]==hair2[i]){
    			cnt++;
    			break;
    		}
    		if(hair1[mid]>hair2[i])big=mid;
    		if(hair1[mid]<hair2[i])sma=mid+1;
    		} sma<big sma big {
    		mid=(big+sma)/2;
    		if(hair1[mid]==hair2[i]){
    			cnt++;
    			break;
    		}
    		if(hair1[mid]>hair2[i])big=mid;
    		if(hair1[mid]<hair2[i])sma=mid+1;
    		} mid=(big+sma)/2 mid (big+sma)/2 (big+sma) big sma 2 if(hair1[mid]==hair2[i]){
    			cnt++;
    			break;
    		} hair1[mid]==hair2[i] hair1[mid] hair1 mid hair2[i] hair2 i {
    			cnt++;
    			break;
    		} cnt++ cnt break; if(hair1[mid]>hair2[i])big=mid; hair1[mid]>hair2[i] hair1[mid] hair1 mid hair2[i] hair2 i big=mid big mid if(hair1[mid]<hair2[i])sma=mid+1; hair1[mid]<hair2[i] hair1[mid] hair1 mid hair2[i] hair2 i sma=mid+1 sma mid+1 mid 1 System.out.println(cnt) System.out.println System.out System System.out cnt String[] args args public class Main{

	public static void main(String[] args) {
		int i,cnt=0,big,sma,mid;
		// TODO Auto-generated method stub
   Scanner sca=new Scanner(System.in);
    int hair1[]=new int[sca.nextInt()];
    for(i=0;i<hair1.length;i++){
    	hair1[i]=sca.nextInt();
    }
    int hair2[]=new int[sca.nextInt()];
    for(i=0;i<hair2.length;i++){
    	hair2[i]=sca.nextInt();
    }
    for(i=0;i<hair2.length;i++){
    	big=hair1.length;
    	sma=0;
    	while(sma<big){
    		mid=(big+sma)/2;
    		if(hair1[mid]==hair2[i]){
    			cnt++;
    			break;
    		}
    		if(hair1[mid]>hair2[i])big=mid;
    		if(hair1[mid]<hair2[i])sma=mid+1;
    		}
    	}
    System.out.println(cnt);
	}

} public class Main{

	public static void main(String[] args) {
		int i,cnt=0,big,sma,mid;
		// TODO Auto-generated method stub
   Scanner sca=new Scanner(System.in);
    int hair1[]=new int[sca.nextInt()];
    for(i=0;i<hair1.length;i++){
    	hair1[i]=sca.nextInt();
    }
    int hair2[]=new int[sca.nextInt()];
    for(i=0;i<hair2.length;i++){
    	hair2[i]=sca.nextInt();
    }
    for(i=0;i<hair2.length;i++){
    	big=hair1.length;
    	sma=0;
    	while(sma<big){
    		mid=(big+sma)/2;
    		if(hair1[mid]==hair2[i]){
    			cnt++;
    			break;
    		}
    		if(hair1[mid]>hair2[i])big=mid;
    		if(hair1[mid]<hair2[i])sma=mid+1;
    		}
    	}
    System.out.println(cnt);
	}

} Main
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		int i,cnt=0,big,sma,mid;
		// TODO Auto-generated method stub
   Scanner sca=new Scanner(System.in);
    int hair1[]=new int[sca.nextInt()];
    for(i=0;i<hair1.length;i++){
    	hair1[i]=sca.nextInt();
    }
    int hair2[]=new int[sca.nextInt()];
    for(i=0;i<hair2.length;i++){
    	hair2[i]=sca.nextInt();
    }
    for(i=0;i<hair2.length;i++){
    	big=hair1.length;
    	sma=0;
    	while(sma<big){
    		mid=(big+sma)/2;
    		if(hair1[mid]==hair2[i]){
    			cnt++;
    			break;
    		}
    		if(hair1[mid]>hair2[i])big=mid;
    		if(hair1[mid]<hair2[i])sma=mid+1;
    		}
    	}
    System.out.println(cnt);
	}

}
