import java.io.*;
import java.util.*;
public class Main{
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n;
        n=sc.nextInt();
        int a[]=new int[n];
        for(int i=0;i<n;i++)a[i]=sc.nextInt();
        int q;
        int ans=0;
        q=sc.nextInt();
        int c;
        int l,r,mid;
        while(q>0){
            q--;
            c=sc.nextInt();
            l=-1;r=n-1;
            while(r-l>1){
                mid=(l+r)/2;
                if(a[mid]>=c)r=mid;
                else l=mid;
            }
            if(a[r]==c)ans++;
        }
        System.out.println(ans);
}
} import java.io.*; io.* java import java.util.*; util.* java public class Main{
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n;
        n=sc.nextInt();
        int a[]=new int[n];
        for(int i=0;i<n;i++)a[i]=sc.nextInt();
        int q;
        int ans=0;
        q=sc.nextInt();
        int c;
        int l,r,mid;
        while(q>0){
            q--;
            c=sc.nextInt();
            l=-1;r=n-1;
            while(r-l>1){
                mid=(l+r)/2;
                if(a[mid]>=c)r=mid;
                else l=mid;
            }
            if(a[r]==c)ans++;
        }
        System.out.println(ans);
}
} Main public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n;
        n=sc.nextInt();
        int a[]=new int[n];
        for(int i=0;i<n;i++)a[i]=sc.nextInt();
        int q;
        int ans=0;
        q=sc.nextInt();
        int c;
        int l,r,mid;
        while(q>0){
            q--;
            c=sc.nextInt();
            l=-1;r=n-1;
            while(r-l>1){
                mid=(l+r)/2;
                if(a[mid]>=c)r=mid;
                else l=mid;
            }
            if(a[r]==c)ans++;
        }
        System.out.println(ans);
} main {
        Scanner sc=new Scanner(System.in);
        int n;
        n=sc.nextInt();
        int a[]=new int[n];
        for(int i=0;i<n;i++)a[i]=sc.nextInt();
        int q;
        int ans=0;
        q=sc.nextInt();
        int c;
        int l,r,mid;
        while(q>0){
            q--;
            c=sc.nextInt();
            l=-1;r=n-1;
            while(r-l>1){
                mid=(l+r)/2;
                if(a[mid]>=c)r=mid;
                else l=mid;
            }
            if(a[r]==c)ans++;
        }
        System.out.println(ans);
} Scanner sc=new Scanner(System.in); sc new Scanner(System.in) int n; n n=sc.nextInt() n sc.nextInt() sc.nextInt sc int a[]=new int[n]; a new int[n] n for(int i=0;i<n;i++)a[i]=sc.nextInt(); int i=0; int i=0; i 0 i<n i n i++ i++ i a[i]=sc.nextInt(); a[i]=sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc int q; q int ans=0; ans 0 q=sc.nextInt() q sc.nextInt() sc.nextInt sc int c; c int l l r r mid; mid while(q>0){
            q--;
            c=sc.nextInt();
            l=-1;r=n-1;
            while(r-l>1){
                mid=(l+r)/2;
                if(a[mid]>=c)r=mid;
                else l=mid;
            }
            if(a[r]==c)ans++;
        } q>0 q 0 {
            q--;
            c=sc.nextInt();
            l=-1;r=n-1;
            while(r-l>1){
                mid=(l+r)/2;
                if(a[mid]>=c)r=mid;
                else l=mid;
            }
            if(a[r]==c)ans++;
        } q-- q c=sc.nextInt() c sc.nextInt() sc.nextInt sc l=-1 l -1 1 r=n-1 r n-1 n 1 while(r-l>1){
                mid=(l+r)/2;
                if(a[mid]>=c)r=mid;
                else l=mid;
            } r-l>1 r-l r l 1 {
                mid=(l+r)/2;
                if(a[mid]>=c)r=mid;
                else l=mid;
            } mid=(l+r)/2 mid (l+r)/2 (l+r) l r 2 if(a[mid]>=c)r=mid;
                else l=mid; a[mid]>=c a[mid] a mid c r=mid r mid l=mid l mid if(a[r]==c)ans++; a[r]==c a[r] a r c ans++ ans System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main{
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n;
        n=sc.nextInt();
        int a[]=new int[n];
        for(int i=0;i<n;i++)a[i]=sc.nextInt();
        int q;
        int ans=0;
        q=sc.nextInt();
        int c;
        int l,r,mid;
        while(q>0){
            q--;
            c=sc.nextInt();
            l=-1;r=n-1;
            while(r-l>1){
                mid=(l+r)/2;
                if(a[mid]>=c)r=mid;
                else l=mid;
            }
            if(a[r]==c)ans++;
        }
        System.out.println(ans);
}
} public class Main{
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n;
        n=sc.nextInt();
        int a[]=new int[n];
        for(int i=0;i<n;i++)a[i]=sc.nextInt();
        int q;
        int ans=0;
        q=sc.nextInt();
        int c;
        int l,r,mid;
        while(q>0){
            q--;
            c=sc.nextInt();
            l=-1;r=n-1;
            while(r-l>1){
                mid=(l+r)/2;
                if(a[mid]>=c)r=mid;
                else l=mid;
            }
            if(a[r]==c)ans++;
        }
        System.out.println(ans);
}
} Main
import java.io.*;
import java.util.*;
public class Main{
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n;
        n=sc.nextInt();
        int a[]=new int[n];
        for(int i=0;i<n;i++)a[i]=sc.nextInt();
        int q;
        int ans=0;
        q=sc.nextInt();
        int c;
        int l,r,mid;
        while(q>0){
            q--;
            c=sc.nextInt();
            l=-1;r=n-1;
            while(r-l>1){
                mid=(l+r)/2;
                if(a[mid]>=c)r=mid;
                else l=mid;
            }
            if(a[r]==c)ans++;
        }
        System.out.println(ans);
}
}
