import java.io.*;
import java.util.Scanner;
import java.util.HashMap;
import java.util.Map;
public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n=scan.nextInt();
        long[] a = new long[n];
        for(int i=0;i<n;i++){a[i]=scan.nextLong();}

        int q=scan.nextInt();
        int ans=0;
        for(int i=0;i<q;i++){
            long t=scan.nextLong();
            if(check(a,t)){
                ans++;
            }
        }
        System.out.println(ans);
    }
    private static boolean check(long[]a,long t){
        int l=0,r=a.length-1;
        while(l<r){
            int mid=(l+r)/2;
            if(a[mid]<t){
                l=mid+1;
            }
            else{
                r=mid;
            }
        }
        if(a[r]==t)return true;
        else return false;
    }
} import java.io.*; io.* java import java.util.Scanner; Scanner java.util import java.util.HashMap; HashMap java.util import java.util.Map; Map java.util public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n=scan.nextInt();
        long[] a = new long[n];
        for(int i=0;i<n;i++){a[i]=scan.nextLong();}

        int q=scan.nextInt();
        int ans=0;
        for(int i=0;i<q;i++){
            long t=scan.nextLong();
            if(check(a,t)){
                ans++;
            }
        }
        System.out.println(ans);
    }
    private static boolean check(long[]a,long t){
        int l=0,r=a.length-1;
        while(l<r){
            int mid=(l+r)/2;
            if(a[mid]<t){
                l=mid+1;
            }
            else{
                r=mid;
            }
        }
        if(a[r]==t)return true;
        else return false;
    }
} Main public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n=scan.nextInt();
        long[] a = new long[n];
        for(int i=0;i<n;i++){a[i]=scan.nextLong();}

        int q=scan.nextInt();
        int ans=0;
        for(int i=0;i<q;i++){
            long t=scan.nextLong();
            if(check(a,t)){
                ans++;
            }
        }
        System.out.println(ans);
    } main {
        Scanner scan = new Scanner(System.in);
        int n=scan.nextInt();
        long[] a = new long[n];
        for(int i=0;i<n;i++){a[i]=scan.nextLong();}

        int q=scan.nextInt();
        int ans=0;
        for(int i=0;i<q;i++){
            long t=scan.nextLong();
            if(check(a,t)){
                ans++;
            }
        }
        System.out.println(ans);
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n=scan.nextInt(); n scan.nextInt() scan.nextInt scan long[] a = new long[n]; a new long[n] n for(int i=0;i<n;i++){a[i]=scan.nextLong();} int i=0; int i=0; i 0 i<n i n i++ i++ i {a[i]=scan.nextLong();} {a[i]=scan.nextLong();} a[i]=scan.nextLong() a[i] a i scan.nextLong() scan.nextLong scan int q=scan.nextInt(); q scan.nextInt() scan.nextInt scan int ans=0; ans 0 for(int i=0;i<q;i++){
            long t=scan.nextLong();
            if(check(a,t)){
                ans++;
            }
        } int i=0; int i=0; i 0 i<q i q i++ i++ i {
            long t=scan.nextLong();
            if(check(a,t)){
                ans++;
            }
        } {
            long t=scan.nextLong();
            if(check(a,t)){
                ans++;
            }
        } long t=scan.nextLong(); t scan.nextLong() scan.nextLong scan if(check(a,t)){
                ans++;
            } check(a,t) check a t {
                ans++;
            } ans++ ans System.out.println(ans) System.out.println System.out System System.out ans String[] args args private static boolean check(long[]a,long t){
        int l=0,r=a.length-1;
        while(l<r){
            int mid=(l+r)/2;
            if(a[mid]<t){
                l=mid+1;
            }
            else{
                r=mid;
            }
        }
        if(a[r]==t)return true;
        else return false;
    } check {
        int l=0,r=a.length-1;
        while(l<r){
            int mid=(l+r)/2;
            if(a[mid]<t){
                l=mid+1;
            }
            else{
                r=mid;
            }
        }
        if(a[r]==t)return true;
        else return false;
    } int l=0 l 0 r=a.length-1; r a.length-1 a.length a a.length 1 while(l<r){
            int mid=(l+r)/2;
            if(a[mid]<t){
                l=mid+1;
            }
            else{
                r=mid;
            }
        } l<r l r {
            int mid=(l+r)/2;
            if(a[mid]<t){
                l=mid+1;
            }
            else{
                r=mid;
            }
        } int mid=(l+r)/2; mid (l+r)/2 (l+r) l r 2 if(a[mid]<t){
                l=mid+1;
            }
            else{
                r=mid;
            } a[mid]<t a[mid] a mid t {
                l=mid+1;
            } l=mid+1 l mid+1 mid 1 {
                r=mid;
            } r=mid r mid if(a[r]==t)return true;
        else return false; a[r]==t a[r] a r t return true; true return false; false long[]a a long t t public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n=scan.nextInt();
        long[] a = new long[n];
        for(int i=0;i<n;i++){a[i]=scan.nextLong();}

        int q=scan.nextInt();
        int ans=0;
        for(int i=0;i<q;i++){
            long t=scan.nextLong();
            if(check(a,t)){
                ans++;
            }
        }
        System.out.println(ans);
    }
    private static boolean check(long[]a,long t){
        int l=0,r=a.length-1;
        while(l<r){
            int mid=(l+r)/2;
            if(a[mid]<t){
                l=mid+1;
            }
            else{
                r=mid;
            }
        }
        if(a[r]==t)return true;
        else return false;
    }
} public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n=scan.nextInt();
        long[] a = new long[n];
        for(int i=0;i<n;i++){a[i]=scan.nextLong();}

        int q=scan.nextInt();
        int ans=0;
        for(int i=0;i<q;i++){
            long t=scan.nextLong();
            if(check(a,t)){
                ans++;
            }
        }
        System.out.println(ans);
    }
    private static boolean check(long[]a,long t){
        int l=0,r=a.length-1;
        while(l<r){
            int mid=(l+r)/2;
            if(a[mid]<t){
                l=mid+1;
            }
            else{
                r=mid;
            }
        }
        if(a[r]==t)return true;
        else return false;
    }
} Main
import java.io.*;
import java.util.Scanner;
import java.util.HashMap;
import java.util.Map;
public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n=scan.nextInt();
        long[] a = new long[n];
        for(int i=0;i<n;i++){a[i]=scan.nextLong();}

        int q=scan.nextInt();
        int ans=0;
        for(int i=0;i<q;i++){
            long t=scan.nextLong();
            if(check(a,t)){
                ans++;
            }
        }
        System.out.println(ans);
    }
    private static boolean check(long[]a,long t){
        int l=0,r=a.length-1;
        while(l<r){
            int mid=(l+r)/2;
            if(a[mid]<t){
                l=mid+1;
            }
            else{
                r=mid;
            }
        }
        if(a[r]==t)return true;
        else return false;
    }
}
