import java.util.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int num = Integer.parseInt(sc.next());
        int[] s = new int[num];
        for(int i=0; i<num; i++){
            s[i] = Integer.parseInt(sc.next());
        }
        
        int q = Integer.parseInt(sc.next());
        int count=0, wanted=0;
        for(int i=0; i<q; i++){
            wanted = Integer.parseInt(sc.next());
            if(binarySearch(s, wanted)>=0) count++;
        }
        System.out.println(count);
    }
    public static int binarySearch(int[] dt, int target){
        int left=0, right=dt.length-1;
        int mid=-1;
        
        while(left<=right){
            mid = (right+left)/2;
            if(dt[mid] == target){
                return mid;
            }
            if(dt[mid] < target){
                left=mid+1;
            }else{
                right=mid-1;
            }
        }
        return -1;
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int num = Integer.parseInt(sc.next());
        int[] s = new int[num];
        for(int i=0; i<num; i++){
            s[i] = Integer.parseInt(sc.next());
        }
        
        int q = Integer.parseInt(sc.next());
        int count=0, wanted=0;
        for(int i=0; i<q; i++){
            wanted = Integer.parseInt(sc.next());
            if(binarySearch(s, wanted)>=0) count++;
        }
        System.out.println(count);
    }
    public static int binarySearch(int[] dt, int target){
        int left=0, right=dt.length-1;
        int mid=-1;
        
        while(left<=right){
            mid = (right+left)/2;
            if(dt[mid] == target){
                return mid;
            }
            if(dt[mid] < target){
                left=mid+1;
            }else{
                right=mid-1;
            }
        }
        return -1;
    }
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int num = Integer.parseInt(sc.next());
        int[] s = new int[num];
        for(int i=0; i<num; i++){
            s[i] = Integer.parseInt(sc.next());
        }
        
        int q = Integer.parseInt(sc.next());
        int count=0, wanted=0;
        for(int i=0; i<q; i++){
            wanted = Integer.parseInt(sc.next());
            if(binarySearch(s, wanted)>=0) count++;
        }
        System.out.println(count);
    } main {
        Scanner sc = new Scanner(System.in);
        
        int num = Integer.parseInt(sc.next());
        int[] s = new int[num];
        for(int i=0; i<num; i++){
            s[i] = Integer.parseInt(sc.next());
        }
        
        int q = Integer.parseInt(sc.next());
        int count=0, wanted=0;
        for(int i=0; i<q; i++){
            wanted = Integer.parseInt(sc.next());
            if(binarySearch(s, wanted)>=0) count++;
        }
        System.out.println(count);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int num = Integer.parseInt(sc.next()); num Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int[] s = new int[num]; s new int[num] num for(int i=0; i<num; i++){
            s[i] = Integer.parseInt(sc.next());
        } int i=0; int i=0; i 0 i<num i num i++ i++ i {
            s[i] = Integer.parseInt(sc.next());
        } {
            s[i] = Integer.parseInt(sc.next());
        } s[i] = Integer.parseInt(sc.next()) s[i] s i Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int q = Integer.parseInt(sc.next()); q Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int count=0 count 0 wanted=0; wanted 0 for(int i=0; i<q; i++){
            wanted = Integer.parseInt(sc.next());
            if(binarySearch(s, wanted)>=0) count++;
        } int i=0; int i=0; i 0 i<q i q i++ i++ i {
            wanted = Integer.parseInt(sc.next());
            if(binarySearch(s, wanted)>=0) count++;
        } {
            wanted = Integer.parseInt(sc.next());
            if(binarySearch(s, wanted)>=0) count++;
        } wanted = Integer.parseInt(sc.next()) wanted Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc if(binarySearch(s, wanted)>=0) count++; binarySearch(s, wanted)>=0 binarySearch(s, wanted) binarySearch s wanted 0 count++ count System.out.println(count) System.out.println System.out System System.out count String[] args args public static int binarySearch(int[] dt, int target){
        int left=0, right=dt.length-1;
        int mid=-1;
        
        while(left<=right){
            mid = (right+left)/2;
            if(dt[mid] == target){
                return mid;
            }
            if(dt[mid] < target){
                left=mid+1;
            }else{
                right=mid-1;
            }
        }
        return -1;
    } binarySearch {
        int left=0, right=dt.length-1;
        int mid=-1;
        
        while(left<=right){
            mid = (right+left)/2;
            if(dt[mid] == target){
                return mid;
            }
            if(dt[mid] < target){
                left=mid+1;
            }else{
                right=mid-1;
            }
        }
        return -1;
    } int left=0 left 0 right=dt.length-1; right dt.length-1 dt.length dt dt.length 1 int mid=-1; mid -1 1 while(left<=right){
            mid = (right+left)/2;
            if(dt[mid] == target){
                return mid;
            }
            if(dt[mid] < target){
                left=mid+1;
            }else{
                right=mid-1;
            }
        } left<=right left right {
            mid = (right+left)/2;
            if(dt[mid] == target){
                return mid;
            }
            if(dt[mid] < target){
                left=mid+1;
            }else{
                right=mid-1;
            }
        } mid = (right+left)/2 mid (right+left)/2 (right+left) right left 2 if(dt[mid] == target){
                return mid;
            } dt[mid] == target dt[mid] dt mid target {
                return mid;
            } return mid; mid if(dt[mid] < target){
                left=mid+1;
            }else{
                right=mid-1;
            } dt[mid] < target dt[mid] dt mid target {
                left=mid+1;
            } left=mid+1 left mid+1 mid 1 {
                right=mid-1;
            } right=mid-1 right mid-1 mid 1 return -1; -1 1 int[] dt dt int target target public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int num = Integer.parseInt(sc.next());
        int[] s = new int[num];
        for(int i=0; i<num; i++){
            s[i] = Integer.parseInt(sc.next());
        }
        
        int q = Integer.parseInt(sc.next());
        int count=0, wanted=0;
        for(int i=0; i<q; i++){
            wanted = Integer.parseInt(sc.next());
            if(binarySearch(s, wanted)>=0) count++;
        }
        System.out.println(count);
    }
    public static int binarySearch(int[] dt, int target){
        int left=0, right=dt.length-1;
        int mid=-1;
        
        while(left<=right){
            mid = (right+left)/2;
            if(dt[mid] == target){
                return mid;
            }
            if(dt[mid] < target){
                left=mid+1;
            }else{
                right=mid-1;
            }
        }
        return -1;
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int num = Integer.parseInt(sc.next());
        int[] s = new int[num];
        for(int i=0; i<num; i++){
            s[i] = Integer.parseInt(sc.next());
        }
        
        int q = Integer.parseInt(sc.next());
        int count=0, wanted=0;
        for(int i=0; i<q; i++){
            wanted = Integer.parseInt(sc.next());
            if(binarySearch(s, wanted)>=0) count++;
        }
        System.out.println(count);
    }
    public static int binarySearch(int[] dt, int target){
        int left=0, right=dt.length-1;
        int mid=-1;
        
        while(left<=right){
            mid = (right+left)/2;
            if(dt[mid] == target){
                return mid;
            }
            if(dt[mid] < target){
                left=mid+1;
            }else{
                right=mid-1;
            }
        }
        return -1;
    }
} Main
import java.util.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int num = Integer.parseInt(sc.next());
        int[] s = new int[num];
        for(int i=0; i<num; i++){
            s[i] = Integer.parseInt(sc.next());
        }
        
        int q = Integer.parseInt(sc.next());
        int count=0, wanted=0;
        for(int i=0; i<q; i++){
            wanted = Integer.parseInt(sc.next());
            if(binarySearch(s, wanted)>=0) count++;
        }
        System.out.println(count);
    }
    public static int binarySearch(int[] dt, int target){
        int left=0, right=dt.length-1;
        int mid=-1;
        
        while(left<=right){
            mid = (right+left)/2;
            if(dt[mid] == target){
                return mid;
            }
            if(dt[mid] < target){
                left=mid+1;
            }else{
                right=mid-1;
            }
        }
        return -1;
    }
}
