import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
   
    int count=0;
    
    int n=sc.nextInt();  
    int array1[]=new int[n];
    for(int i=0;i<n;i++)array1[i]=sc.nextInt();
    
    int q=sc.nextInt();
    int array2[]=new int[q];
    for(int i=0;i<q;i++) array2[i]=sc.nextInt();
   
    for(int i=0;i<q;i++){
      int start=0;
      int goal=n-1;
      while(true){
        int middle=(int)(start+goal)/2;
        if(array2[i]==array1[middle]){
          count+=1;
          break;
        }
        if(start-goal>-1) break;
        else if(array1[middle]<array2[i]) start=middle+1;
        else if(array2[i]<array1[middle]) goal=middle-1;
      }
    }
    System.out.println(count);
  }
} import java.util.Scanner; Scanner java.util public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
   
    int count=0;
    
    int n=sc.nextInt();  
    int array1[]=new int[n];
    for(int i=0;i<n;i++)array1[i]=sc.nextInt();
    
    int q=sc.nextInt();
    int array2[]=new int[q];
    for(int i=0;i<q;i++) array2[i]=sc.nextInt();
   
    for(int i=0;i<q;i++){
      int start=0;
      int goal=n-1;
      while(true){
        int middle=(int)(start+goal)/2;
        if(array2[i]==array1[middle]){
          count+=1;
          break;
        }
        if(start-goal>-1) break;
        else if(array1[middle]<array2[i]) start=middle+1;
        else if(array2[i]<array1[middle]) goal=middle-1;
      }
    }
    System.out.println(count);
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
   
    int count=0;
    
    int n=sc.nextInt();  
    int array1[]=new int[n];
    for(int i=0;i<n;i++)array1[i]=sc.nextInt();
    
    int q=sc.nextInt();
    int array2[]=new int[q];
    for(int i=0;i<q;i++) array2[i]=sc.nextInt();
   
    for(int i=0;i<q;i++){
      int start=0;
      int goal=n-1;
      while(true){
        int middle=(int)(start+goal)/2;
        if(array2[i]==array1[middle]){
          count+=1;
          break;
        }
        if(start-goal>-1) break;
        else if(array1[middle]<array2[i]) start=middle+1;
        else if(array2[i]<array1[middle]) goal=middle-1;
      }
    }
    System.out.println(count);
  } main {
    Scanner sc = new Scanner(System.in);
   
    int count=0;
    
    int n=sc.nextInt();  
    int array1[]=new int[n];
    for(int i=0;i<n;i++)array1[i]=sc.nextInt();
    
    int q=sc.nextInt();
    int array2[]=new int[q];
    for(int i=0;i<q;i++) array2[i]=sc.nextInt();
   
    for(int i=0;i<q;i++){
      int start=0;
      int goal=n-1;
      while(true){
        int middle=(int)(start+goal)/2;
        if(array2[i]==array1[middle]){
          count+=1;
          break;
        }
        if(start-goal>-1) break;
        else if(array1[middle]<array2[i]) start=middle+1;
        else if(array2[i]<array1[middle]) goal=middle-1;
      }
    }
    System.out.println(count);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int count=0; count 0 int n=sc.nextInt(); n sc.nextInt() sc.nextInt sc int array1[]=new int[n]; array1 new int[n] n for(int i=0;i<n;i++)array1[i]=sc.nextInt(); int i=0; int i=0; i 0 i<n i n i++ i++ i array1[i]=sc.nextInt(); array1[i]=sc.nextInt() array1[i] array1 i sc.nextInt() sc.nextInt sc int q=sc.nextInt(); q sc.nextInt() sc.nextInt sc int array2[]=new int[q]; array2 new int[q] q for(int i=0;i<q;i++) array2[i]=sc.nextInt(); int i=0; int i=0; i 0 i<q i q i++ i++ i array2[i]=sc.nextInt(); array2[i]=sc.nextInt() array2[i] array2 i sc.nextInt() sc.nextInt sc for(int i=0;i<q;i++){
      int start=0;
      int goal=n-1;
      while(true){
        int middle=(int)(start+goal)/2;
        if(array2[i]==array1[middle]){
          count+=1;
          break;
        }
        if(start-goal>-1) break;
        else if(array1[middle]<array2[i]) start=middle+1;
        else if(array2[i]<array1[middle]) goal=middle-1;
      }
    } int i=0; int i=0; i 0 i<q i q i++ i++ i {
      int start=0;
      int goal=n-1;
      while(true){
        int middle=(int)(start+goal)/2;
        if(array2[i]==array1[middle]){
          count+=1;
          break;
        }
        if(start-goal>-1) break;
        else if(array1[middle]<array2[i]) start=middle+1;
        else if(array2[i]<array1[middle]) goal=middle-1;
      }
    } {
      int start=0;
      int goal=n-1;
      while(true){
        int middle=(int)(start+goal)/2;
        if(array2[i]==array1[middle]){
          count+=1;
          break;
        }
        if(start-goal>-1) break;
        else if(array1[middle]<array2[i]) start=middle+1;
        else if(array2[i]<array1[middle]) goal=middle-1;
      }
    } int start=0; start 0 int goal=n-1; goal n-1 n 1 while(true){
        int middle=(int)(start+goal)/2;
        if(array2[i]==array1[middle]){
          count+=1;
          break;
        }
        if(start-goal>-1) break;
        else if(array1[middle]<array2[i]) start=middle+1;
        else if(array2[i]<array1[middle]) goal=middle-1;
      } true {
        int middle=(int)(start+goal)/2;
        if(array2[i]==array1[middle]){
          count+=1;
          break;
        }
        if(start-goal>-1) break;
        else if(array1[middle]<array2[i]) start=middle+1;
        else if(array2[i]<array1[middle]) goal=middle-1;
      } int middle=(int)(start+goal)/2; middle (int)(start+goal)/2 (int)(start+goal) start goal 2 if(array2[i]==array1[middle]){
          count+=1;
          break;
        } array2[i]==array1[middle] array2[i] array2 i array1[middle] array1 middle {
          count+=1;
          break;
        } count+=1 count 1 break; if(start-goal>-1) break;
        else if(array1[middle]<array2[i]) start=middle+1;
        else if(array2[i]<array1[middle]) goal=middle-1; start-goal>-1 start-goal start goal -1 1 break; if(array1[middle]<array2[i]) start=middle+1;
        else if(array2[i]<array1[middle]) goal=middle-1; array1[middle]<array2[i] array1[middle] array1 middle array2[i] array2 i start=middle+1 start middle+1 middle 1 if(array2[i]<array1[middle]) goal=middle-1; array2[i]<array1[middle] array2[i] array2 i array1[middle] array1 middle goal=middle-1 goal middle-1 middle 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){
    Scanner sc = new Scanner(System.in);
   
    int count=0;
    
    int n=sc.nextInt();  
    int array1[]=new int[n];
    for(int i=0;i<n;i++)array1[i]=sc.nextInt();
    
    int q=sc.nextInt();
    int array2[]=new int[q];
    for(int i=0;i<q;i++) array2[i]=sc.nextInt();
   
    for(int i=0;i<q;i++){
      int start=0;
      int goal=n-1;
      while(true){
        int middle=(int)(start+goal)/2;
        if(array2[i]==array1[middle]){
          count+=1;
          break;
        }
        if(start-goal>-1) break;
        else if(array1[middle]<array2[i]) start=middle+1;
        else if(array2[i]<array1[middle]) goal=middle-1;
      }
    }
    System.out.println(count);
  }
} public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
   
    int count=0;
    
    int n=sc.nextInt();  
    int array1[]=new int[n];
    for(int i=0;i<n;i++)array1[i]=sc.nextInt();
    
    int q=sc.nextInt();
    int array2[]=new int[q];
    for(int i=0;i<q;i++) array2[i]=sc.nextInt();
   
    for(int i=0;i<q;i++){
      int start=0;
      int goal=n-1;
      while(true){
        int middle=(int)(start+goal)/2;
        if(array2[i]==array1[middle]){
          count+=1;
          break;
        }
        if(start-goal>-1) break;
        else if(array1[middle]<array2[i]) start=middle+1;
        else if(array2[i]<array1[middle]) goal=middle-1;
      }
    }
    System.out.println(count);
  }
} Main
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
   
    int count=0;
    
    int n=sc.nextInt();  
    int array1[]=new int[n];
    for(int i=0;i<n;i++)array1[i]=sc.nextInt();
    
    int q=sc.nextInt();
    int array2[]=new int[q];
    for(int i=0;i<q;i++) array2[i]=sc.nextInt();
   
    for(int i=0;i<q;i++){
      int start=0;
      int goal=n-1;
      while(true){
        int middle=(int)(start+goal)/2;
        if(array2[i]==array1[middle]){
          count+=1;
          break;
        }
        if(start-goal>-1) break;
        else if(array1[middle]<array2[i]) start=middle+1;
        else if(array2[i]<array1[middle]) goal=middle-1;
      }
    }
    System.out.println(count);
  }
}
