import java.util.Scanner;
public class Main {
    static int n;
    static int s[];
    public static void main(String[] arg){
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        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 ans = 0;
        for(int i: t){
            if(bsearch(i, 0, n-1)){
                ans++;
            }
        }
        System.out.println(ans);
        sc.close();
    }
    
    public static boolean bsearch(int k, int i, int j){
        
        if(s[(i+j)/2]==k){
            return true;
        }else if(i>j){
            return false;
        }else if(s[(i+j)/2]<k){
            return bsearch(k, (i+j)/2+1, j);
        }else if(s[(i+j)/2]>k){
            return bsearch(k, i, (i+j)/2-1);
        }
        return false;
    }
} import java.util.Scanner; Scanner java.util public class Main {
    static int n;
    static int s[];
    public static void main(String[] arg){
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        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 ans = 0;
        for(int i: t){
            if(bsearch(i, 0, n-1)){
                ans++;
            }
        }
        System.out.println(ans);
        sc.close();
    }
    
    public static boolean bsearch(int k, int i, int j){
        
        if(s[(i+j)/2]==k){
            return true;
        }else if(i>j){
            return false;
        }else if(s[(i+j)/2]<k){
            return bsearch(k, (i+j)/2+1, j);
        }else if(s[(i+j)/2]>k){
            return bsearch(k, i, (i+j)/2-1);
        }
        return false;
    }
} Main static int n; n static int s[]; s public static void main(String[] arg){
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        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 ans = 0;
        for(int i: t){
            if(bsearch(i, 0, n-1)){
                ans++;
            }
        }
        System.out.println(ans);
        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        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 ans = 0;
        for(int i: t){
            if(bsearch(i, 0, n-1)){
                ans++;
            }
        }
        System.out.println(ans);
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) n = sc.nextInt() n sc.nextInt() sc.nextInt sc 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 ans = 0; ans 0 for(int i: t){
            if(bsearch(i, 0, n-1)){
                ans++;
            }
        } int i t {
            if(bsearch(i, 0, n-1)){
                ans++;
            }
        } {
            if(bsearch(i, 0, n-1)){
                ans++;
            }
        } if(bsearch(i, 0, n-1)){
                ans++;
            } bsearch(i, 0, n-1) bsearch i 0 n-1 n 1 {
                ans++;
            } ans++ ans System.out.println(ans) System.out.println System.out System System.out ans sc.close() sc.close sc String[] arg arg public static boolean bsearch(int k, int i, int j){
        
        if(s[(i+j)/2]==k){
            return true;
        }else if(i>j){
            return false;
        }else if(s[(i+j)/2]<k){
            return bsearch(k, (i+j)/2+1, j);
        }else if(s[(i+j)/2]>k){
            return bsearch(k, i, (i+j)/2-1);
        }
        return false;
    } bsearch {
        
        if(s[(i+j)/2]==k){
            return true;
        }else if(i>j){
            return false;
        }else if(s[(i+j)/2]<k){
            return bsearch(k, (i+j)/2+1, j);
        }else if(s[(i+j)/2]>k){
            return bsearch(k, i, (i+j)/2-1);
        }
        return false;
    } if(s[(i+j)/2]==k){
            return true;
        }else if(i>j){
            return false;
        }else if(s[(i+j)/2]<k){
            return bsearch(k, (i+j)/2+1, j);
        }else if(s[(i+j)/2]>k){
            return bsearch(k, i, (i+j)/2-1);
        } s[(i+j)/2]==k s[(i+j)/2] s (i+j)/2 (i+j) i j 2 k {
            return true;
        } return true; true if(i>j){
            return false;
        }else if(s[(i+j)/2]<k){
            return bsearch(k, (i+j)/2+1, j);
        }else if(s[(i+j)/2]>k){
            return bsearch(k, i, (i+j)/2-1);
        } i>j i j {
            return false;
        } return false; false if(s[(i+j)/2]<k){
            return bsearch(k, (i+j)/2+1, j);
        }else if(s[(i+j)/2]>k){
            return bsearch(k, i, (i+j)/2-1);
        } s[(i+j)/2]<k s[(i+j)/2] s (i+j)/2 (i+j) i j 2 k {
            return bsearch(k, (i+j)/2+1, j);
        } return bsearch(k, (i+j)/2+1, j); bsearch(k, (i+j)/2+1, j) bsearch k (i+j)/2+1 (i+j)/2 (i+j) i j 2 1 j if(s[(i+j)/2]>k){
            return bsearch(k, i, (i+j)/2-1);
        } s[(i+j)/2]>k s[(i+j)/2] s (i+j)/2 (i+j) i j 2 k {
            return bsearch(k, i, (i+j)/2-1);
        } return bsearch(k, i, (i+j)/2-1); bsearch(k, i, (i+j)/2-1) bsearch k i (i+j)/2-1 (i+j)/2 (i+j) i j 2 1 return false; false int k k int i i int j j public class Main {
    static int n;
    static int s[];
    public static void main(String[] arg){
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        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 ans = 0;
        for(int i: t){
            if(bsearch(i, 0, n-1)){
                ans++;
            }
        }
        System.out.println(ans);
        sc.close();
    }
    
    public static boolean bsearch(int k, int i, int j){
        
        if(s[(i+j)/2]==k){
            return true;
        }else if(i>j){
            return false;
        }else if(s[(i+j)/2]<k){
            return bsearch(k, (i+j)/2+1, j);
        }else if(s[(i+j)/2]>k){
            return bsearch(k, i, (i+j)/2-1);
        }
        return false;
    }
} public class Main {
    static int n;
    static int s[];
    public static void main(String[] arg){
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        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 ans = 0;
        for(int i: t){
            if(bsearch(i, 0, n-1)){
                ans++;
            }
        }
        System.out.println(ans);
        sc.close();
    }
    
    public static boolean bsearch(int k, int i, int j){
        
        if(s[(i+j)/2]==k){
            return true;
        }else if(i>j){
            return false;
        }else if(s[(i+j)/2]<k){
            return bsearch(k, (i+j)/2+1, j);
        }else if(s[(i+j)/2]>k){
            return bsearch(k, i, (i+j)/2-1);
        }
        return false;
    }
} Main
import java.util.Scanner;
public class Main {
    static int n;
    static int s[];
    public static void main(String[] arg){
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        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 ans = 0;
        for(int i: t){
            if(bsearch(i, 0, n-1)){
                ans++;
            }
        }
        System.out.println(ans);
        sc.close();
    }
    
    public static boolean bsearch(int k, int i, int j){
        
        if(s[(i+j)/2]==k){
            return true;
        }else if(i>j){
            return false;
        }else if(s[(i+j)/2]<k){
            return bsearch(k, (i+j)/2+1, j);
        }else if(s[(i+j)/2]>k){
            return bsearch(k, i, (i+j)/2-1);
        }
        return false;
    }
}
