import java.util.*;

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

        int n = sc.nextInt();
        HashSet<Integer> S = new HashSet<>();
        for(int i = 0;i < n;i++){
            S.add(sc.nextInt());
        }
        
        int q = sc.nextInt();
        int count = 0;
        for(int i = 0;i < q;i++){
            if(S.contains(sc.nextInt()))    count++;
        }

        System.out.println(count);
    }
} import java.util.*; util.* java class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        HashSet<Integer> S = new HashSet<>();
        for(int i = 0;i < n;i++){
            S.add(sc.nextInt());
        }
        
        int q = sc.nextInt();
        int count = 0;
        for(int i = 0;i < q;i++){
            if(S.contains(sc.nextInt()))    count++;
        }

        System.out.println(count);
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        HashSet<Integer> S = new HashSet<>();
        for(int i = 0;i < n;i++){
            S.add(sc.nextInt());
        }
        
        int q = sc.nextInt();
        int count = 0;
        for(int i = 0;i < q;i++){
            if(S.contains(sc.nextInt()))    count++;
        }

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

        int n = sc.nextInt();
        HashSet<Integer> S = new HashSet<>();
        for(int i = 0;i < n;i++){
            S.add(sc.nextInt());
        }
        
        int q = sc.nextInt();
        int count = 0;
        for(int i = 0;i < q;i++){
            if(S.contains(sc.nextInt()))    count++;
        }

        System.out.println(count);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc HashSet<Integer> S = new HashSet<>(); S new HashSet<>() for(int i = 0;i < n;i++){
            S.add(sc.nextInt());
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            S.add(sc.nextInt());
        } {
            S.add(sc.nextInt());
        } S.add(sc.nextInt()) S.add S sc.nextInt() sc.nextInt sc int q = sc.nextInt(); q sc.nextInt() sc.nextInt sc int count = 0; count 0 for(int i = 0;i < q;i++){
            if(S.contains(sc.nextInt()))    count++;
        } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
            if(S.contains(sc.nextInt()))    count++;
        } {
            if(S.contains(sc.nextInt()))    count++;
        } if(S.contains(sc.nextInt()))    count++; S.contains(sc.nextInt()) S.contains S sc.nextInt() sc.nextInt sc count++ count System.out.println(count) System.out.println System.out System System.out count String[] args args
import java.util.*;

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

        int n = sc.nextInt();
        HashSet<Integer> S = new HashSet<>();
        for(int i = 0;i < n;i++){
            S.add(sc.nextInt());
        }
        
        int q = sc.nextInt();
        int count = 0;
        for(int i = 0;i < q;i++){
            if(S.contains(sc.nextInt()))    count++;
        }

        System.out.println(count);
    }
}
