import java.util.Scanner;

class Main
{
    static int n;
    static int q;

    static int Search(int[]s, int t, int n)
    {
        int left = 0;
        int right = n;

        while(left < right)
            {
                int mid = (left + right) / 2;

                if(s[mid] == t)
                    return 1;

                else if(t < s[mid])
                    right = mid;

                else 
                    left = mid + 1;
            }
        return 0;
    }

    public static void main(String[]args)
    {
        Scanner In = new Scanner(System.in);

        n = In.nextInt();
        int []S = new int[n];

        for(int i = 0; i < n; i++)
            {
                S[i] = In.nextInt();
            }

        q = In.nextInt();
        int []T = new int[q];

        for(int i = 0; i < q; i++)
            {
                T[i] = In.nextInt();
            }

        int count = 0;
        for(int i = 0; i < q; i++)
            {
                count += Search(S,T[i],n);
            }

        System.out.println(count);
    }
} import java.util.Scanner; Scanner java.util class Main
{
    static int n;
    static int q;

    static int Search(int[]s, int t, int n)
    {
        int left = 0;
        int right = n;

        while(left < right)
            {
                int mid = (left + right) / 2;

                if(s[mid] == t)
                    return 1;

                else if(t < s[mid])
                    right = mid;

                else 
                    left = mid + 1;
            }
        return 0;
    }

    public static void main(String[]args)
    {
        Scanner In = new Scanner(System.in);

        n = In.nextInt();
        int []S = new int[n];

        for(int i = 0; i < n; i++)
            {
                S[i] = In.nextInt();
            }

        q = In.nextInt();
        int []T = new int[q];

        for(int i = 0; i < q; i++)
            {
                T[i] = In.nextInt();
            }

        int count = 0;
        for(int i = 0; i < q; i++)
            {
                count += Search(S,T[i],n);
            }

        System.out.println(count);
    }
} Main static int n; n static int q; q static int Search(int[]s, int t, int n)
    {
        int left = 0;
        int right = n;

        while(left < right)
            {
                int mid = (left + right) / 2;

                if(s[mid] == t)
                    return 1;

                else if(t < s[mid])
                    right = mid;

                else 
                    left = mid + 1;
            }
        return 0;
    } Search {
        int left = 0;
        int right = n;

        while(left < right)
            {
                int mid = (left + right) / 2;

                if(s[mid] == t)
                    return 1;

                else if(t < s[mid])
                    right = mid;

                else 
                    left = mid + 1;
            }
        return 0;
    } int left = 0; left 0 int right = n; right n while(left < right)
            {
                int mid = (left + right) / 2;

                if(s[mid] == t)
                    return 1;

                else if(t < s[mid])
                    right = mid;

                else 
                    left = mid + 1;
            } left < right left right {
                int mid = (left + right) / 2;

                if(s[mid] == t)
                    return 1;

                else if(t < s[mid])
                    right = mid;

                else 
                    left = mid + 1;
            } int mid = (left + right) / 2; mid (left + right) / 2 (left + right) left right 2 if(s[mid] == t)
                    return 1;

                else if(t < s[mid])
                    right = mid;

                else 
                    left = mid + 1; s[mid] == t s[mid] s mid t return 1; 1 if(t < s[mid])
                    right = mid;

                else 
                    left = mid + 1; t < s[mid] t s[mid] s mid right = mid right mid left = mid + 1 left mid + 1 mid 1 return 0; 0 int[]s s int t t int n n public static void main(String[]args)
    {
        Scanner In = new Scanner(System.in);

        n = In.nextInt();
        int []S = new int[n];

        for(int i = 0; i < n; i++)
            {
                S[i] = In.nextInt();
            }

        q = In.nextInt();
        int []T = new int[q];

        for(int i = 0; i < q; i++)
            {
                T[i] = In.nextInt();
            }

        int count = 0;
        for(int i = 0; i < q; i++)
            {
                count += Search(S,T[i],n);
            }

        System.out.println(count);
    } main {
        Scanner In = new Scanner(System.in);

        n = In.nextInt();
        int []S = new int[n];

        for(int i = 0; i < n; i++)
            {
                S[i] = In.nextInt();
            }

        q = In.nextInt();
        int []T = new int[q];

        for(int i = 0; i < q; i++)
            {
                T[i] = In.nextInt();
            }

        int count = 0;
        for(int i = 0; i < q; i++)
            {
                count += Search(S,T[i],n);
            }

        System.out.println(count);
    } Scanner In = new Scanner(System.in); In new Scanner(System.in) n = In.nextInt() n In.nextInt() In.nextInt In int []S = new int[n]; S new int[n] n for(int i = 0; i < n; i++)
            {
                S[i] = In.nextInt();
            } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
                S[i] = In.nextInt();
            } {
                S[i] = In.nextInt();
            } S[i] = In.nextInt() S[i] S i In.nextInt() In.nextInt In q = In.nextInt() q In.nextInt() In.nextInt In int []T = new int[q]; T new int[q] q for(int i = 0; i < q; i++)
            {
                T[i] = In.nextInt();
            } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
                T[i] = In.nextInt();
            } {
                T[i] = In.nextInt();
            } T[i] = In.nextInt() T[i] T i In.nextInt() In.nextInt In int count = 0; count 0 for(int i = 0; i < q; i++)
            {
                count += Search(S,T[i],n);
            } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
                count += Search(S,T[i],n);
            } {
                count += Search(S,T[i],n);
            } count += Search(S,T[i],n) count Search(S,T[i],n) Search S T[i] T i n System.out.println(count) System.out.println System.out System System.out count String[]args args
import java.util.Scanner;

class Main
{
    static int n;
    static int q;

    static int Search(int[]s, int t, int n)
    {
        int left = 0;
        int right = n;

        while(left < right)
            {
                int mid = (left + right) / 2;

                if(s[mid] == t)
                    return 1;

                else if(t < s[mid])
                    right = mid;

                else 
                    left = mid + 1;
            }
        return 0;
    }

    public static void main(String[]args)
    {
        Scanner In = new Scanner(System.in);

        n = In.nextInt();
        int []S = new int[n];

        for(int i = 0; i < n; i++)
            {
                S[i] = In.nextInt();
            }

        q = In.nextInt();
        int []T = new int[q];

        for(int i = 0; i < q; i++)
            {
                T[i] = In.nextInt();
            }

        int count = 0;
        for(int i = 0; i < q; i++)
            {
                count += Search(S,T[i],n);
            }

        System.out.println(count);
    }
}