import java.util.Scanner;
 
 
 class Main{
 
   public static boolean search(int A[],int n,int key){
		
		int left =0;
		int mid;
		int right =n;
		
		while(left<right){
			mid=(left+right)/2;
			if(key==A[mid]) 
				return true; 
			if(key>A[mid])
				left=mid+1;
			else if(key<A[mid])
				right =mid;
		}
		return false;
	}

    public static void main(String[] args) {
        int A[]=new int[1000000];
        int i,j,n,q,key,sum=0;
         
        Scanner s =new Scanner(System.in);
        n=s.nextInt();
        for(i=0;i<n;i++){
            A[i]=s.nextInt();
        }
         
        q=s.nextInt();
        for(j=0;j<q;j++){
            key=s.nextInt();

            if(search(A,n,key))
                          sum++;
        }
      System.out.println(sum);
    }
 
} import java.util.Scanner; Scanner java.util class Main{
 
   public static boolean search(int A[],int n,int key){
		
		int left =0;
		int mid;
		int right =n;
		
		while(left<right){
			mid=(left+right)/2;
			if(key==A[mid]) 
				return true; 
			if(key>A[mid])
				left=mid+1;
			else if(key<A[mid])
				right =mid;
		}
		return false;
	}

    public static void main(String[] args) {
        int A[]=new int[1000000];
        int i,j,n,q,key,sum=0;
         
        Scanner s =new Scanner(System.in);
        n=s.nextInt();
        for(i=0;i<n;i++){
            A[i]=s.nextInt();
        }
         
        q=s.nextInt();
        for(j=0;j<q;j++){
            key=s.nextInt();

            if(search(A,n,key))
                          sum++;
        }
      System.out.println(sum);
    }
 
} Main public static boolean search(int A[],int n,int key){
		
		int left =0;
		int mid;
		int right =n;
		
		while(left<right){
			mid=(left+right)/2;
			if(key==A[mid]) 
				return true; 
			if(key>A[mid])
				left=mid+1;
			else if(key<A[mid])
				right =mid;
		}
		return false;
	} search {
		
		int left =0;
		int mid;
		int right =n;
		
		while(left<right){
			mid=(left+right)/2;
			if(key==A[mid]) 
				return true; 
			if(key>A[mid])
				left=mid+1;
			else if(key<A[mid])
				right =mid;
		}
		return false;
	} int left =0; left 0 int mid; mid int right =n; right n while(left<right){
			mid=(left+right)/2;
			if(key==A[mid]) 
				return true; 
			if(key>A[mid])
				left=mid+1;
			else if(key<A[mid])
				right =mid;
		} left<right left right {
			mid=(left+right)/2;
			if(key==A[mid]) 
				return true; 
			if(key>A[mid])
				left=mid+1;
			else if(key<A[mid])
				right =mid;
		} mid=(left+right)/2 mid (left+right)/2 (left+right) left right 2 if(key==A[mid]) 
				return true; key==A[mid] key A[mid] A mid return true; true if(key>A[mid])
				left=mid+1;
			else if(key<A[mid])
				right =mid; key>A[mid] key A[mid] A mid left=mid+1 left mid+1 mid 1 if(key<A[mid])
				right =mid; key<A[mid] key A[mid] A mid right =mid right mid return false; false int A[] A int n n int key key public static void main(String[] args) {
        int A[]=new int[1000000];
        int i,j,n,q,key,sum=0;
         
        Scanner s =new Scanner(System.in);
        n=s.nextInt();
        for(i=0;i<n;i++){
            A[i]=s.nextInt();
        }
         
        q=s.nextInt();
        for(j=0;j<q;j++){
            key=s.nextInt();

            if(search(A,n,key))
                          sum++;
        }
      System.out.println(sum);
    } main {
        int A[]=new int[1000000];
        int i,j,n,q,key,sum=0;
         
        Scanner s =new Scanner(System.in);
        n=s.nextInt();
        for(i=0;i<n;i++){
            A[i]=s.nextInt();
        }
         
        q=s.nextInt();
        for(j=0;j<q;j++){
            key=s.nextInt();

            if(search(A,n,key))
                          sum++;
        }
      System.out.println(sum);
    } int A[]=new int[1000000]; A new int[1000000] 1000000 int i i j j n n q q key key sum=0; sum 0 Scanner s =new Scanner(System.in); s new Scanner(System.in) n=s.nextInt() n s.nextInt() s.nextInt s for(i=0;i<n;i++){
            A[i]=s.nextInt();
        } i=0; i=0 i 0 i<n i n i++ i++ i {
            A[i]=s.nextInt();
        } {
            A[i]=s.nextInt();
        } A[i]=s.nextInt() A[i] A i s.nextInt() s.nextInt s q=s.nextInt() q s.nextInt() s.nextInt s for(j=0;j<q;j++){
            key=s.nextInt();

            if(search(A,n,key))
                          sum++;
        } j=0; j=0 j 0 j<q j q j++ j++ j {
            key=s.nextInt();

            if(search(A,n,key))
                          sum++;
        } {
            key=s.nextInt();

            if(search(A,n,key))
                          sum++;
        } key=s.nextInt() key s.nextInt() s.nextInt s if(search(A,n,key))
                          sum++; search(A,n,key) search A n key sum++ sum System.out.println(sum) System.out.println System.out System System.out sum String[] args args
import java.util.Scanner;
 
 
 class Main{
 
   public static boolean search(int A[],int n,int key){
		
		int left =0;
		int mid;
		int right =n;
		
		while(left<right){
			mid=(left+right)/2;
			if(key==A[mid]) 
				return true; 
			if(key>A[mid])
				left=mid+1;
			else if(key<A[mid])
				right =mid;
		}
		return false;
	}

    public static void main(String[] args) {
        int A[]=new int[1000000];
        int i,j,n,q,key,sum=0;
         
        Scanner s =new Scanner(System.in);
        n=s.nextInt();
        for(i=0;i<n;i++){
            A[i]=s.nextInt();
        }
         
        q=s.nextInt();
        for(j=0;j<q;j++){
            key=s.nextInt();

            if(search(A,n,key))
                          sum++;
        }
      System.out.println(sum);
    }
 
}