import java.util.Arrays;

class Main {

    private static final int CONST= 1000000007;
    public static void main(String args[]) {
		java.util.Scanner sc = new java.util.Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] S = new int[n];
        for(int i=0; i<n; i++)  S[i] = Integer.parseInt(sc.next());

        int q = Integer.parseInt(sc.next());
        int[] T = new int[q];
        for(int i=0; i<q; i++)  T[i] = Integer.parseInt(sc.next());

        int count = 0;
        for(int element : T){
            if(Arrays.binarySearch(S, element) >= 0)    count++;
        }
        System.out.println(count);
        sc.close();
    }
} import java.util.Arrays; Arrays java.util class Main {

    private static final int CONST= 1000000007;
    public static void main(String args[]) {
		java.util.Scanner sc = new java.util.Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] S = new int[n];
        for(int i=0; i<n; i++)  S[i] = Integer.parseInt(sc.next());

        int q = Integer.parseInt(sc.next());
        int[] T = new int[q];
        for(int i=0; i<q; i++)  T[i] = Integer.parseInt(sc.next());

        int count = 0;
        for(int element : T){
            if(Arrays.binarySearch(S, element) >= 0)    count++;
        }
        System.out.println(count);
        sc.close();
    }
} Main private static final int CONST= 1000000007; CONST 1000000007 public static void main(String args[]) {
		java.util.Scanner sc = new java.util.Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] S = new int[n];
        for(int i=0; i<n; i++)  S[i] = Integer.parseInt(sc.next());

        int q = Integer.parseInt(sc.next());
        int[] T = new int[q];
        for(int i=0; i<q; i++)  T[i] = Integer.parseInt(sc.next());

        int count = 0;
        for(int element : T){
            if(Arrays.binarySearch(S, element) >= 0)    count++;
        }
        System.out.println(count);
        sc.close();
    } main {
		java.util.Scanner sc = new java.util.Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] S = new int[n];
        for(int i=0; i<n; i++)  S[i] = Integer.parseInt(sc.next());

        int q = Integer.parseInt(sc.next());
        int[] T = new int[q];
        for(int i=0; i<q; i++)  T[i] = Integer.parseInt(sc.next());

        int count = 0;
        for(int element : T){
            if(Arrays.binarySearch(S, element) >= 0)    count++;
        }
        System.out.println(count);
        sc.close();
    } java.util.Scanner sc = new java.util.Scanner(System.in); sc new java.util.Scanner(System.in) int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int[] S = new int[n]; S new int[n] n for(int i=0; i<n; i++)  S[i] = Integer.parseInt(sc.next()); int i=0; int i=0; i 0 i<n i n i++ i++ i S[i] = Integer.parseInt(sc.next()); S[i] = Integer.parseInt(sc.next()) S[i] S i Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int q = Integer.parseInt(sc.next()); q Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int[] T = new int[q]; T new int[q] q for(int i=0; i<q; i++)  T[i] = Integer.parseInt(sc.next()); int i=0; int i=0; i 0 i<q i q i++ i++ i T[i] = Integer.parseInt(sc.next()); T[i] = Integer.parseInt(sc.next()) T[i] T i Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int count = 0; count 0 for(int element : T){
            if(Arrays.binarySearch(S, element) >= 0)    count++;
        } int element T {
            if(Arrays.binarySearch(S, element) >= 0)    count++;
        } {
            if(Arrays.binarySearch(S, element) >= 0)    count++;
        } if(Arrays.binarySearch(S, element) >= 0)    count++; Arrays.binarySearch(S, element) >= 0 Arrays.binarySearch(S, element) Arrays.binarySearch Arrays S element 0 count++ count System.out.println(count) System.out.println System.out System System.out count sc.close() sc.close sc String args[] args
import java.util.Arrays;

class Main {

    private static final int CONST= 1000000007;
    public static void main(String args[]) {
		java.util.Scanner sc = new java.util.Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] S = new int[n];
        for(int i=0; i<n; i++)  S[i] = Integer.parseInt(sc.next());

        int q = Integer.parseInt(sc.next());
        int[] T = new int[q];
        for(int i=0; i<q; i++)  T[i] = Integer.parseInt(sc.next());

        int count = 0;
        for(int element : T){
            if(Arrays.binarySearch(S, element) >= 0)    count++;
        }
        System.out.println(count);
        sc.close();
    }
}
