import java.util.Scanner;

public class Main{
    static Scanner sc = new Scanner(System.in);
    
    private static boolean binarySearch(int[] array, int key){
        int left = 0;
        int right = array.length;
        int mid = 0;
        while(left < right){
            mid = (left + right) / 2;
            if(array[mid] == key) return true;
            if(array[mid] < key){
                left = mid + 1;
            }else if(array[mid] > key){
                right = mid;
            }
        }
        return false;
    }
    
    private static int[] inputArray(){
        int num = sc.nextInt();
        int[] array = new int[num];
        for(int i = 0; i < num; i++){
            array[i] = sc.nextInt();
        }
        return array;
    }    
    
    public static void main(String[] args){
        int[] s = inputArray();
        int[] t = inputArray();
        int count = 0;
        
        for(int i = 0; i < t.length; i++){
            if(binarySearch(s, t[i])){
                count++;
            }
        }
        System.out.println(count);
    }
} import java.util.Scanner; Scanner java.util public class Main{
    static Scanner sc = new Scanner(System.in);
    
    private static boolean binarySearch(int[] array, int key){
        int left = 0;
        int right = array.length;
        int mid = 0;
        while(left < right){
            mid = (left + right) / 2;
            if(array[mid] == key) return true;
            if(array[mid] < key){
                left = mid + 1;
            }else if(array[mid] > key){
                right = mid;
            }
        }
        return false;
    }
    
    private static int[] inputArray(){
        int num = sc.nextInt();
        int[] array = new int[num];
        for(int i = 0; i < num; i++){
            array[i] = sc.nextInt();
        }
        return array;
    }    
    
    public static void main(String[] args){
        int[] s = inputArray();
        int[] t = inputArray();
        int count = 0;
        
        for(int i = 0; i < t.length; i++){
            if(binarySearch(s, t[i])){
                count++;
            }
        }
        System.out.println(count);
    }
} Main static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) private static boolean binarySearch(int[] array, int key){
        int left = 0;
        int right = array.length;
        int mid = 0;
        while(left < right){
            mid = (left + right) / 2;
            if(array[mid] == key) return true;
            if(array[mid] < key){
                left = mid + 1;
            }else if(array[mid] > key){
                right = mid;
            }
        }
        return false;
    } binarySearch {
        int left = 0;
        int right = array.length;
        int mid = 0;
        while(left < right){
            mid = (left + right) / 2;
            if(array[mid] == key) return true;
            if(array[mid] < key){
                left = mid + 1;
            }else if(array[mid] > key){
                right = mid;
            }
        }
        return false;
    } int left = 0; left 0 int right = array.length; right array.length array array.length int mid = 0; mid 0 while(left < right){
            mid = (left + right) / 2;
            if(array[mid] == key) return true;
            if(array[mid] < key){
                left = mid + 1;
            }else if(array[mid] > key){
                right = mid;
            }
        } left < right left right {
            mid = (left + right) / 2;
            if(array[mid] == key) return true;
            if(array[mid] < key){
                left = mid + 1;
            }else if(array[mid] > key){
                right = mid;
            }
        } mid = (left + right) / 2 mid (left + right) / 2 (left + right) left right 2 if(array[mid] == key) return true; array[mid] == key array[mid] array mid key return true; true if(array[mid] < key){
                left = mid + 1;
            }else if(array[mid] > key){
                right = mid;
            } array[mid] < key array[mid] array mid key {
                left = mid + 1;
            } left = mid + 1 left mid + 1 mid 1 if(array[mid] > key){
                right = mid;
            } array[mid] > key array[mid] array mid key {
                right = mid;
            } right = mid right mid return false; false int[] array array int key key private static int[] inputArray(){
        int num = sc.nextInt();
        int[] array = new int[num];
        for(int i = 0; i < num; i++){
            array[i] = sc.nextInt();
        }
        return array;
    } inputArray {
        int num = sc.nextInt();
        int[] array = new int[num];
        for(int i = 0; i < num; i++){
            array[i] = sc.nextInt();
        }
        return array;
    } int num = sc.nextInt(); num sc.nextInt() sc.nextInt sc int[] array = new int[num]; array new int[num] num for(int i = 0; i < num; i++){
            array[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < num i num i++ i++ i {
            array[i] = sc.nextInt();
        } {
            array[i] = sc.nextInt();
        } array[i] = sc.nextInt() array[i] array i sc.nextInt() sc.nextInt sc return array; array public static void main(String[] args){
        int[] s = inputArray();
        int[] t = inputArray();
        int count = 0;
        
        for(int i = 0; i < t.length; i++){
            if(binarySearch(s, t[i])){
                count++;
            }
        }
        System.out.println(count);
    } main {
        int[] s = inputArray();
        int[] t = inputArray();
        int count = 0;
        
        for(int i = 0; i < t.length; i++){
            if(binarySearch(s, t[i])){
                count++;
            }
        }
        System.out.println(count);
    } int[] s = inputArray(); s inputArray() inputArray int[] t = inputArray(); t inputArray() inputArray int count = 0; count 0 for(int i = 0; i < t.length; i++){
            if(binarySearch(s, t[i])){
                count++;
            }
        } int i = 0; int i = 0; i 0 i < t.length i t.length t t.length 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 class Main{
    static Scanner sc = new Scanner(System.in);
    
    private static boolean binarySearch(int[] array, int key){
        int left = 0;
        int right = array.length;
        int mid = 0;
        while(left < right){
            mid = (left + right) / 2;
            if(array[mid] == key) return true;
            if(array[mid] < key){
                left = mid + 1;
            }else if(array[mid] > key){
                right = mid;
            }
        }
        return false;
    }
    
    private static int[] inputArray(){
        int num = sc.nextInt();
        int[] array = new int[num];
        for(int i = 0; i < num; i++){
            array[i] = sc.nextInt();
        }
        return array;
    }    
    
    public static void main(String[] args){
        int[] s = inputArray();
        int[] t = inputArray();
        int count = 0;
        
        for(int i = 0; i < t.length; i++){
            if(binarySearch(s, t[i])){
                count++;
            }
        }
        System.out.println(count);
    }
} public class Main{
    static Scanner sc = new Scanner(System.in);
    
    private static boolean binarySearch(int[] array, int key){
        int left = 0;
        int right = array.length;
        int mid = 0;
        while(left < right){
            mid = (left + right) / 2;
            if(array[mid] == key) return true;
            if(array[mid] < key){
                left = mid + 1;
            }else if(array[mid] > key){
                right = mid;
            }
        }
        return false;
    }
    
    private static int[] inputArray(){
        int num = sc.nextInt();
        int[] array = new int[num];
        for(int i = 0; i < num; i++){
            array[i] = sc.nextInt();
        }
        return array;
    }    
    
    public static void main(String[] args){
        int[] s = inputArray();
        int[] t = inputArray();
        int count = 0;
        
        for(int i = 0; i < t.length; i++){
            if(binarySearch(s, t[i])){
                count++;
            }
        }
        System.out.println(count);
    }
} Main
import java.util.Scanner;

public class Main{
    static Scanner sc = new Scanner(System.in);
    
    private static boolean binarySearch(int[] array, int key){
        int left = 0;
        int right = array.length;
        int mid = 0;
        while(left < right){
            mid = (left + right) / 2;
            if(array[mid] == key) return true;
            if(array[mid] < key){
                left = mid + 1;
            }else if(array[mid] > key){
                right = mid;
            }
        }
        return false;
    }
    
    private static int[] inputArray(){
        int num = sc.nextInt();
        int[] array = new int[num];
        for(int i = 0; i < num; i++){
            array[i] = sc.nextInt();
        }
        return array;
    }    
    
    public static void main(String[] args){
        int[] s = inputArray();
        int[] t = inputArray();
        int count = 0;
        
        for(int i = 0; i < t.length; i++){
            if(binarySearch(s, t[i])){
                count++;
            }
        }
        System.out.println(count);
    }
}
