import java.io.IOException;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws IOException {

        Scanner sc = new Scanner(System.in);
        int n1 = sc.nextInt();
        int sp1[] = new int[n1];
        for (int i = 0; i < n1; i++) {
            sp1[i] = sc.nextInt();
        }
        int n2 = sc.nextInt();
        int sp2[] = new int[n1];
        for (int i = 0; i < n2; i++) {
            sp2[i] = sc.nextInt();
        }
        int sum = 0;
        for (int j = 0; j < n2; j++) {
            if ( Arrays.binarySearch(sp1, sp2[j])>0) {
                sum++;
            }
        }
        System.out.println(sum);
    }
} import java.io.IOException; IOException java.io import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) throws IOException {

        Scanner sc = new Scanner(System.in);
        int n1 = sc.nextInt();
        int sp1[] = new int[n1];
        for (int i = 0; i < n1; i++) {
            sp1[i] = sc.nextInt();
        }
        int n2 = sc.nextInt();
        int sp2[] = new int[n1];
        for (int i = 0; i < n2; i++) {
            sp2[i] = sc.nextInt();
        }
        int sum = 0;
        for (int j = 0; j < n2; j++) {
            if ( Arrays.binarySearch(sp1, sp2[j])>0) {
                sum++;
            }
        }
        System.out.println(sum);
    }
} Main public static void main(String[] args) throws IOException {

        Scanner sc = new Scanner(System.in);
        int n1 = sc.nextInt();
        int sp1[] = new int[n1];
        for (int i = 0; i < n1; i++) {
            sp1[i] = sc.nextInt();
        }
        int n2 = sc.nextInt();
        int sp2[] = new int[n1];
        for (int i = 0; i < n2; i++) {
            sp2[i] = sc.nextInt();
        }
        int sum = 0;
        for (int j = 0; j < n2; j++) {
            if ( Arrays.binarySearch(sp1, sp2[j])>0) {
                sum++;
            }
        }
        System.out.println(sum);
    } main {

        Scanner sc = new Scanner(System.in);
        int n1 = sc.nextInt();
        int sp1[] = new int[n1];
        for (int i = 0; i < n1; i++) {
            sp1[i] = sc.nextInt();
        }
        int n2 = sc.nextInt();
        int sp2[] = new int[n1];
        for (int i = 0; i < n2; i++) {
            sp2[i] = sc.nextInt();
        }
        int sum = 0;
        for (int j = 0; j < n2; j++) {
            if ( Arrays.binarySearch(sp1, sp2[j])>0) {
                sum++;
            }
        }
        System.out.println(sum);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n1 = sc.nextInt(); n1 sc.nextInt() sc.nextInt sc int sp1[] = new int[n1]; sp1 new int[n1] n1 for (int i = 0; i < n1; i++) {
            sp1[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < n1 i n1 i++ i++ i {
            sp1[i] = sc.nextInt();
        } {
            sp1[i] = sc.nextInt();
        } sp1[i] = sc.nextInt() sp1[i] sp1 i sc.nextInt() sc.nextInt sc int n2 = sc.nextInt(); n2 sc.nextInt() sc.nextInt sc int sp2[] = new int[n1]; sp2 new int[n1] n1 for (int i = 0; i < n2; i++) {
            sp2[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < n2 i n2 i++ i++ i {
            sp2[i] = sc.nextInt();
        } {
            sp2[i] = sc.nextInt();
        } sp2[i] = sc.nextInt() sp2[i] sp2 i sc.nextInt() sc.nextInt sc int sum = 0; sum 0 for (int j = 0; j < n2; j++) {
            if ( Arrays.binarySearch(sp1, sp2[j])>0) {
                sum++;
            }
        } int j = 0; int j = 0; j 0 j < n2 j n2 j++ j++ j {
            if ( Arrays.binarySearch(sp1, sp2[j])>0) {
                sum++;
            }
        } {
            if ( Arrays.binarySearch(sp1, sp2[j])>0) {
                sum++;
            }
        } if ( Arrays.binarySearch(sp1, sp2[j])>0) {
                sum++;
            } Arrays.binarySearch(sp1, sp2[j])>0 Arrays.binarySearch(sp1, sp2[j]) Arrays.binarySearch Arrays sp1 sp2[j] sp2 j 0 {
                sum++;
            } sum++ sum System.out.println(sum) System.out.println System.out System System.out sum String[] args args public class Main {
    public static void main(String[] args) throws IOException {

        Scanner sc = new Scanner(System.in);
        int n1 = sc.nextInt();
        int sp1[] = new int[n1];
        for (int i = 0; i < n1; i++) {
            sp1[i] = sc.nextInt();
        }
        int n2 = sc.nextInt();
        int sp2[] = new int[n1];
        for (int i = 0; i < n2; i++) {
            sp2[i] = sc.nextInt();
        }
        int sum = 0;
        for (int j = 0; j < n2; j++) {
            if ( Arrays.binarySearch(sp1, sp2[j])>0) {
                sum++;
            }
        }
        System.out.println(sum);
    }
} public class Main {
    public static void main(String[] args) throws IOException {

        Scanner sc = new Scanner(System.in);
        int n1 = sc.nextInt();
        int sp1[] = new int[n1];
        for (int i = 0; i < n1; i++) {
            sp1[i] = sc.nextInt();
        }
        int n2 = sc.nextInt();
        int sp2[] = new int[n1];
        for (int i = 0; i < n2; i++) {
            sp2[i] = sc.nextInt();
        }
        int sum = 0;
        for (int j = 0; j < n2; j++) {
            if ( Arrays.binarySearch(sp1, sp2[j])>0) {
                sum++;
            }
        }
        System.out.println(sum);
    }
} Main
import java.io.IOException;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws IOException {

        Scanner sc = new Scanner(System.in);
        int n1 = sc.nextInt();
        int sp1[] = new int[n1];
        for (int i = 0; i < n1; i++) {
            sp1[i] = sc.nextInt();
        }
        int n2 = sc.nextInt();
        int sp2[] = new int[n1];
        for (int i = 0; i < n2; i++) {
            sp2[i] = sc.nextInt();
        }
        int sum = 0;
        for (int j = 0; j < n2; j++) {
            if ( Arrays.binarySearch(sp1, sp2[j])>0) {
                sum++;
            }
        }
        System.out.println(sum);
    }
}
