import java.io.IOException;
import java.util.*;

public class Main {
    public static void main(String[] args) throws IOException {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] S = new int[n];
        for(int i = 0; i < n; i++){
            S[i] = sc.nextInt();
        }
        int q = sc.nextInt();
        int[] T = new int[q];
        for(int i = 0; i < q; i++){
            T[i] = sc.nextInt();
        }
        int count = 0;
        
        
        for(int i = 0; i < q; i++){
            if(BinarySearch(S, T[i])){
                count++;
            }
        }
        System.out.println(count);
   }
   
   public static boolean BinarySearch(int[] S, int key){
       int left = 0;
       int right = S.length - 1;
       int mid = 0;
       
       while(left <= right){
           //System.out.println(left + " " + right + " " + mid);
           mid = (left + right)/2;
           if(S[mid] == key){
               // System.out.println(key + " " + mid);
                return true;
           }else if (key < S[mid]){
                right = mid-1;
           }else{
                left = mid+1;
           }
       }
       return false;
   }
} import java.io.IOException; IOException java.io import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws IOException {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] S = new int[n];
        for(int i = 0; i < n; i++){
            S[i] = sc.nextInt();
        }
        int q = sc.nextInt();
        int[] T = new int[q];
        for(int i = 0; i < q; i++){
            T[i] = sc.nextInt();
        }
        int count = 0;
        
        
        for(int i = 0; i < q; i++){
            if(BinarySearch(S, T[i])){
                count++;
            }
        }
        System.out.println(count);
   }
   
   public static boolean BinarySearch(int[] S, int key){
       int left = 0;
       int right = S.length - 1;
       int mid = 0;
       
       while(left <= right){
           //System.out.println(left + " " + right + " " + mid);
           mid = (left + right)/2;
           if(S[mid] == key){
               // System.out.println(key + " " + mid);
                return true;
           }else if (key < S[mid]){
                right = mid-1;
           }else{
                left = mid+1;
           }
       }
       return false;
   }
} Main public static void main(String[] args) throws IOException {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] S = new int[n];
        for(int i = 0; i < n; i++){
            S[i] = sc.nextInt();
        }
        int q = sc.nextInt();
        int[] T = new int[q];
        for(int i = 0; i < q; i++){
            T[i] = sc.nextInt();
        }
        int count = 0;
        
        
        for(int i = 0; i < q; i++){
            if(BinarySearch(S, T[i])){
                count++;
            }
        }
        System.out.println(count);
   } main {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] S = new int[n];
        for(int i = 0; i < n; i++){
            S[i] = sc.nextInt();
        }
        int q = sc.nextInt();
        int[] T = new int[q];
        for(int i = 0; i < q; i++){
            T[i] = sc.nextInt();
        }
        int count = 0;
        
        
        for(int i = 0; i < q; i++){
            if(BinarySearch(S, T[i])){
                count++;
            }
        }
        System.out.println(count);
   } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] S = new int[n]; S new int[n] n for(int i = 0; i < n; i++){
            S[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            S[i] = sc.nextInt();
        } {
            S[i] = sc.nextInt();
        } S[i] = sc.nextInt() S[i] S i sc.nextInt() sc.nextInt sc int q = sc.nextInt(); q sc.nextInt() sc.nextInt sc int[] T = new int[q]; T new int[q] q for(int i = 0; i < q; i++){
            T[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
            T[i] = sc.nextInt();
        } {
            T[i] = sc.nextInt();
        } T[i] = sc.nextInt() T[i] T i sc.nextInt() sc.nextInt sc int count = 0; count 0 for(int i = 0; i < q; i++){
            if(BinarySearch(S, T[i])){
                count++;
            }
        } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
            if(BinarySearch(S, T[i])){
                count++;
            }
        } {
            if(BinarySearch(S, T[i])){
                count++;
            }
        } if(BinarySearch(S, T[i])){
                count++;
            } BinarySearch(S, T[i]) BinarySearch S T[i] T i {
                count++;
            } count++ count System.out.println(count) System.out.println System.out System System.out count String[] args args public static boolean BinarySearch(int[] S, int key){
       int left = 0;
       int right = S.length - 1;
       int mid = 0;
       
       while(left <= right){
           //System.out.println(left + " " + right + " " + mid);
           mid = (left + right)/2;
           if(S[mid] == key){
               // System.out.println(key + " " + mid);
                return true;
           }else if (key < S[mid]){
                right = mid-1;
           }else{
                left = mid+1;
           }
       }
       return false;
   } BinarySearch {
       int left = 0;
       int right = S.length - 1;
       int mid = 0;
       
       while(left <= right){
           //System.out.println(left + " " + right + " " + mid);
           mid = (left + right)/2;
           if(S[mid] == key){
               // System.out.println(key + " " + mid);
                return true;
           }else if (key < S[mid]){
                right = mid-1;
           }else{
                left = mid+1;
           }
       }
       return false;
   } int left = 0; left 0 int right = S.length - 1; right S.length - 1 S.length S S.length 1 int mid = 0; mid 0 while(left <= right){
           //System.out.println(left + " " + right + " " + mid);
           mid = (left + right)/2;
           if(S[mid] == key){
               // System.out.println(key + " " + mid);
                return true;
           }else if (key < S[mid]){
                right = mid-1;
           }else{
                left = mid+1;
           }
       } left <= right left right {
           //System.out.println(left + " " + right + " " + mid);
           mid = (left + right)/2;
           if(S[mid] == key){
               // System.out.println(key + " " + mid);
                return true;
           }else if (key < S[mid]){
                right = mid-1;
           }else{
                left = mid+1;
           }
       } mid = (left + right)/2 mid (left + right)/2 (left + right) left right 2 if(S[mid] == key){
               // System.out.println(key + " " + mid);
                return true;
           }else if (key < S[mid]){
                right = mid-1;
           }else{
                left = mid+1;
           } S[mid] == key S[mid] S mid key {
               // System.out.println(key + " " + mid);
                return true;
           } return true; true if (key < S[mid]){
                right = mid-1;
           }else{
                left = mid+1;
           } key < S[mid] key S[mid] S mid {
                right = mid-1;
           } right = mid-1 right mid-1 mid 1 {
                left = mid+1;
           } left = mid+1 left mid+1 mid 1 return false; false int[] S S int key key public class Main {
    public static void main(String[] args) throws IOException {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] S = new int[n];
        for(int i = 0; i < n; i++){
            S[i] = sc.nextInt();
        }
        int q = sc.nextInt();
        int[] T = new int[q];
        for(int i = 0; i < q; i++){
            T[i] = sc.nextInt();
        }
        int count = 0;
        
        
        for(int i = 0; i < q; i++){
            if(BinarySearch(S, T[i])){
                count++;
            }
        }
        System.out.println(count);
   }
   
   public static boolean BinarySearch(int[] S, int key){
       int left = 0;
       int right = S.length - 1;
       int mid = 0;
       
       while(left <= right){
           //System.out.println(left + " " + right + " " + mid);
           mid = (left + right)/2;
           if(S[mid] == key){
               // System.out.println(key + " " + mid);
                return true;
           }else if (key < S[mid]){
                right = mid-1;
           }else{
                left = mid+1;
           }
       }
       return false;
   }
} public class Main {
    public static void main(String[] args) throws IOException {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] S = new int[n];
        for(int i = 0; i < n; i++){
            S[i] = sc.nextInt();
        }
        int q = sc.nextInt();
        int[] T = new int[q];
        for(int i = 0; i < q; i++){
            T[i] = sc.nextInt();
        }
        int count = 0;
        
        
        for(int i = 0; i < q; i++){
            if(BinarySearch(S, T[i])){
                count++;
            }
        }
        System.out.println(count);
   }
   
   public static boolean BinarySearch(int[] S, int key){
       int left = 0;
       int right = S.length - 1;
       int mid = 0;
       
       while(left <= right){
           //System.out.println(left + " " + right + " " + mid);
           mid = (left + right)/2;
           if(S[mid] == key){
               // System.out.println(key + " " + mid);
                return true;
           }else if (key < S[mid]){
                right = mid-1;
           }else{
                left = mid+1;
           }
       }
       return false;
   }
} Main
import java.io.IOException;
import java.util.*;

public class Main {
    public static void main(String[] args) throws IOException {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] S = new int[n];
        for(int i = 0; i < n; i++){
            S[i] = sc.nextInt();
        }
        int q = sc.nextInt();
        int[] T = new int[q];
        for(int i = 0; i < q; i++){
            T[i] = sc.nextInt();
        }
        int count = 0;
        
        
        for(int i = 0; i < q; i++){
            if(BinarySearch(S, T[i])){
                count++;
            }
        }
        System.out.println(count);
   }
   
   public static boolean BinarySearch(int[] S, int key){
       int left = 0;
       int right = S.length - 1;
       int mid = 0;
       
       while(left <= right){
           //System.out.println(left + " " + right + " " + mid);
           mid = (left + right)/2;
           if(S[mid] == key){
               // System.out.println(key + " " + mid);
                return true;
           }else if (key < S[mid]){
                right = mid-1;
           }else{
                left = mid+1;
           }
       }
       return false;
   }
}
