import java.util.Scanner;

public class Main {
    public static void main(String[] args ){
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int S[] = new int[100000];
        for(int i = 0; i < n; i++)
            S[i] = scanner.nextInt();
        int q = scanner.nextInt();
        int T[] = new int[50000];
        for(int i = 0; i < q; i++)
            T[i] = scanner.nextInt();
        scanner.close();

        int amount = 0;
        for(int i = 0; i < q; i++){
            if(search(0, n - 1, S, T[i]))
                amount++;
        }
        System.out.println(amount);
    }

    public static boolean search(int s, int e, int[] A, int p){
        if(s == e){
            if(A[s] == p)
                return true;
            else
                return false;
        }
        else{
            if(A[(s + e)/2] == p)
                return true;
            else if(A[(s + e)/2] > p)
                return search(s, (s + e)/2, A, p);
            else
                return search((s + e)/2 + 1, e, A, p);
        }
    }

}
 import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args ){
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int S[] = new int[100000];
        for(int i = 0; i < n; i++)
            S[i] = scanner.nextInt();
        int q = scanner.nextInt();
        int T[] = new int[50000];
        for(int i = 0; i < q; i++)
            T[i] = scanner.nextInt();
        scanner.close();

        int amount = 0;
        for(int i = 0; i < q; i++){
            if(search(0, n - 1, S, T[i]))
                amount++;
        }
        System.out.println(amount);
    }

    public static boolean search(int s, int e, int[] A, int p){
        if(s == e){
            if(A[s] == p)
                return true;
            else
                return false;
        }
        else{
            if(A[(s + e)/2] == p)
                return true;
            else if(A[(s + e)/2] > p)
                return search(s, (s + e)/2, A, p);
            else
                return search((s + e)/2 + 1, e, A, p);
        }
    }

} Main public static void main(String[] args ){
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int S[] = new int[100000];
        for(int i = 0; i < n; i++)
            S[i] = scanner.nextInt();
        int q = scanner.nextInt();
        int T[] = new int[50000];
        for(int i = 0; i < q; i++)
            T[i] = scanner.nextInt();
        scanner.close();

        int amount = 0;
        for(int i = 0; i < q; i++){
            if(search(0, n - 1, S, T[i]))
                amount++;
        }
        System.out.println(amount);
    } main {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int S[] = new int[100000];
        for(int i = 0; i < n; i++)
            S[i] = scanner.nextInt();
        int q = scanner.nextInt();
        int T[] = new int[50000];
        for(int i = 0; i < q; i++)
            T[i] = scanner.nextInt();
        scanner.close();

        int amount = 0;
        for(int i = 0; i < q; i++){
            if(search(0, n - 1, S, T[i]))
                amount++;
        }
        System.out.println(amount);
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int n = scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner int S[] = new int[100000]; S new int[100000] 100000 for(int i = 0; i < n; i++)
            S[i] = scanner.nextInt(); int i = 0; int i = 0; i 0 i < n i n i++ i++ i S[i] = scanner.nextInt(); S[i] = scanner.nextInt() S[i] S i scanner.nextInt() scanner.nextInt scanner int q = scanner.nextInt(); q scanner.nextInt() scanner.nextInt scanner int T[] = new int[50000]; T new int[50000] 50000 for(int i = 0; i < q; i++)
            T[i] = scanner.nextInt(); int i = 0; int i = 0; i 0 i < q i q i++ i++ i T[i] = scanner.nextInt(); T[i] = scanner.nextInt() T[i] T i scanner.nextInt() scanner.nextInt scanner scanner.close() scanner.close scanner int amount = 0; amount 0 for(int i = 0; i < q; i++){
            if(search(0, n - 1, S, T[i]))
                amount++;
        } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
            if(search(0, n - 1, S, T[i]))
                amount++;
        } {
            if(search(0, n - 1, S, T[i]))
                amount++;
        } if(search(0, n - 1, S, T[i]))
                amount++; search(0, n - 1, S, T[i]) search 0 n - 1 n 1 S T[i] T i amount++ amount System.out.println(amount) System.out.println System.out System System.out amount String[] args args public static boolean search(int s, int e, int[] A, int p){
        if(s == e){
            if(A[s] == p)
                return true;
            else
                return false;
        }
        else{
            if(A[(s + e)/2] == p)
                return true;
            else if(A[(s + e)/2] > p)
                return search(s, (s + e)/2, A, p);
            else
                return search((s + e)/2 + 1, e, A, p);
        }
    } search {
        if(s == e){
            if(A[s] == p)
                return true;
            else
                return false;
        }
        else{
            if(A[(s + e)/2] == p)
                return true;
            else if(A[(s + e)/2] > p)
                return search(s, (s + e)/2, A, p);
            else
                return search((s + e)/2 + 1, e, A, p);
        }
    } if(s == e){
            if(A[s] == p)
                return true;
            else
                return false;
        }
        else{
            if(A[(s + e)/2] == p)
                return true;
            else if(A[(s + e)/2] > p)
                return search(s, (s + e)/2, A, p);
            else
                return search((s + e)/2 + 1, e, A, p);
        } s == e s e {
            if(A[s] == p)
                return true;
            else
                return false;
        } if(A[s] == p)
                return true;
            else
                return false; A[s] == p A[s] A s p return true; true return false; false {
            if(A[(s + e)/2] == p)
                return true;
            else if(A[(s + e)/2] > p)
                return search(s, (s + e)/2, A, p);
            else
                return search((s + e)/2 + 1, e, A, p);
        } if(A[(s + e)/2] == p)
                return true;
            else if(A[(s + e)/2] > p)
                return search(s, (s + e)/2, A, p);
            else
                return search((s + e)/2 + 1, e, A, p); A[(s + e)/2] == p A[(s + e)/2] A (s + e)/2 (s + e) s e 2 p return true; true if(A[(s + e)/2] > p)
                return search(s, (s + e)/2, A, p);
            else
                return search((s + e)/2 + 1, e, A, p); A[(s + e)/2] > p A[(s + e)/2] A (s + e)/2 (s + e) s e 2 p return search(s, (s + e)/2, A, p); search(s, (s + e)/2, A, p) search s (s + e)/2 (s + e) s e 2 A p return search((s + e)/2 + 1, e, A, p); search((s + e)/2 + 1, e, A, p) search (s + e)/2 + 1 (s + e)/2 (s + e) s e 2 1 e A p int s s int e e int[] A A int p p public class Main {
    public static void main(String[] args ){
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int S[] = new int[100000];
        for(int i = 0; i < n; i++)
            S[i] = scanner.nextInt();
        int q = scanner.nextInt();
        int T[] = new int[50000];
        for(int i = 0; i < q; i++)
            T[i] = scanner.nextInt();
        scanner.close();

        int amount = 0;
        for(int i = 0; i < q; i++){
            if(search(0, n - 1, S, T[i]))
                amount++;
        }
        System.out.println(amount);
    }

    public static boolean search(int s, int e, int[] A, int p){
        if(s == e){
            if(A[s] == p)
                return true;
            else
                return false;
        }
        else{
            if(A[(s + e)/2] == p)
                return true;
            else if(A[(s + e)/2] > p)
                return search(s, (s + e)/2, A, p);
            else
                return search((s + e)/2 + 1, e, A, p);
        }
    }

} public class Main {
    public static void main(String[] args ){
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int S[] = new int[100000];
        for(int i = 0; i < n; i++)
            S[i] = scanner.nextInt();
        int q = scanner.nextInt();
        int T[] = new int[50000];
        for(int i = 0; i < q; i++)
            T[i] = scanner.nextInt();
        scanner.close();

        int amount = 0;
        for(int i = 0; i < q; i++){
            if(search(0, n - 1, S, T[i]))
                amount++;
        }
        System.out.println(amount);
    }

    public static boolean search(int s, int e, int[] A, int p){
        if(s == e){
            if(A[s] == p)
                return true;
            else
                return false;
        }
        else{
            if(A[(s + e)/2] == p)
                return true;
            else if(A[(s + e)/2] > p)
                return search(s, (s + e)/2, A, p);
            else
                return search((s + e)/2 + 1, e, A, p);
        }
    }

} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args ){
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int S[] = new int[100000];
        for(int i = 0; i < n; i++)
            S[i] = scanner.nextInt();
        int q = scanner.nextInt();
        int T[] = new int[50000];
        for(int i = 0; i < q; i++)
            T[i] = scanner.nextInt();
        scanner.close();

        int amount = 0;
        for(int i = 0; i < q; i++){
            if(search(0, n - 1, S, T[i]))
                amount++;
        }
        System.out.println(amount);
    }

    public static boolean search(int s, int e, int[] A, int p){
        if(s == e){
            if(A[s] == p)
                return true;
            else
                return false;
        }
        else{
            if(A[(s + e)/2] == p)
                return true;
            else if(A[(s + e)/2] > p)
                return search(s, (s + e)/2, A, p);
            else
                return search((s + e)/2 + 1, e, A, p);
        }
    }

}

