import java.util.*;

public class Main {

    static int NOT_FOUND = 99999999;

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] sArr = new int[n + 1];
        for (int i = 0; i < n; i++) {
            sArr[i] = sc.nextInt();
        }

        int q = sc.nextInt();
        int[] tArr = new int[q + 1];
        int count = 0;
        for (int i = 0; i < q; i++) {
            int x = sc.nextInt();
            tArr[i] = x;
            if (linearSearch(n, sArr, x) != NOT_FOUND) count++;
        }
        System.out.println(count);
    }

    public static int linearSearch(int n, int[] arr, int key) {
        int i = 0;
        arr[n] = key;
        while (arr[i] != key) {
            i++;
        }
        if (i == n) {
            return NOT_FOUND;
        }
        return i;
    }
}
 import java.util.*; util.* java public class Main {

    static int NOT_FOUND = 99999999;

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] sArr = new int[n + 1];
        for (int i = 0; i < n; i++) {
            sArr[i] = sc.nextInt();
        }

        int q = sc.nextInt();
        int[] tArr = new int[q + 1];
        int count = 0;
        for (int i = 0; i < q; i++) {
            int x = sc.nextInt();
            tArr[i] = x;
            if (linearSearch(n, sArr, x) != NOT_FOUND) count++;
        }
        System.out.println(count);
    }

    public static int linearSearch(int n, int[] arr, int key) {
        int i = 0;
        arr[n] = key;
        while (arr[i] != key) {
            i++;
        }
        if (i == n) {
            return NOT_FOUND;
        }
        return i;
    }
} Main static int NOT_FOUND = 99999999; NOT_FOUND 99999999 public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] sArr = new int[n + 1];
        for (int i = 0; i < n; i++) {
            sArr[i] = sc.nextInt();
        }

        int q = sc.nextInt();
        int[] tArr = new int[q + 1];
        int count = 0;
        for (int i = 0; i < q; i++) {
            int x = sc.nextInt();
            tArr[i] = x;
            if (linearSearch(n, sArr, x) != NOT_FOUND) count++;
        }
        System.out.println(count);
    } main {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] sArr = new int[n + 1];
        for (int i = 0; i < n; i++) {
            sArr[i] = sc.nextInt();
        }

        int q = sc.nextInt();
        int[] tArr = new int[q + 1];
        int count = 0;
        for (int i = 0; i < q; i++) {
            int x = sc.nextInt();
            tArr[i] = x;
            if (linearSearch(n, sArr, x) != NOT_FOUND) 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 int[] sArr = new int[n + 1]; sArr new int[n + 1] n + 1 n 1 for (int i = 0; i < n; i++) {
            sArr[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            sArr[i] = sc.nextInt();
        } {
            sArr[i] = sc.nextInt();
        } sArr[i] = sc.nextInt() sArr[i] sArr i sc.nextInt() sc.nextInt sc int q = sc.nextInt(); q sc.nextInt() sc.nextInt sc int[] tArr = new int[q + 1]; tArr new int[q + 1] q + 1 q 1 int count = 0; count 0 for (int i = 0; i < q; i++) {
            int x = sc.nextInt();
            tArr[i] = x;
            if (linearSearch(n, sArr, x) != NOT_FOUND) count++;
        } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
            int x = sc.nextInt();
            tArr[i] = x;
            if (linearSearch(n, sArr, x) != NOT_FOUND) count++;
        } {
            int x = sc.nextInt();
            tArr[i] = x;
            if (linearSearch(n, sArr, x) != NOT_FOUND) count++;
        } int x = sc.nextInt(); x sc.nextInt() sc.nextInt sc tArr[i] = x tArr[i] tArr i x if (linearSearch(n, sArr, x) != NOT_FOUND) count++; linearSearch(n, sArr, x) != NOT_FOUND linearSearch(n, sArr, x) linearSearch n sArr x NOT_FOUND count++ count System.out.println(count) System.out.println System.out System System.out count String[] args args public static int linearSearch(int n, int[] arr, int key) {
        int i = 0;
        arr[n] = key;
        while (arr[i] != key) {
            i++;
        }
        if (i == n) {
            return NOT_FOUND;
        }
        return i;
    } linearSearch {
        int i = 0;
        arr[n] = key;
        while (arr[i] != key) {
            i++;
        }
        if (i == n) {
            return NOT_FOUND;
        }
        return i;
    } int i = 0; i 0 arr[n] = key arr[n] arr n key while (arr[i] != key) {
            i++;
        } arr[i] != key arr[i] arr i key {
            i++;
        } i++ i if (i == n) {
            return NOT_FOUND;
        } i == n i n {
            return NOT_FOUND;
        } return NOT_FOUND; NOT_FOUND return i; i int n n int[] arr arr int key key public class Main {

    static int NOT_FOUND = 99999999;

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] sArr = new int[n + 1];
        for (int i = 0; i < n; i++) {
            sArr[i] = sc.nextInt();
        }

        int q = sc.nextInt();
        int[] tArr = new int[q + 1];
        int count = 0;
        for (int i = 0; i < q; i++) {
            int x = sc.nextInt();
            tArr[i] = x;
            if (linearSearch(n, sArr, x) != NOT_FOUND) count++;
        }
        System.out.println(count);
    }

    public static int linearSearch(int n, int[] arr, int key) {
        int i = 0;
        arr[n] = key;
        while (arr[i] != key) {
            i++;
        }
        if (i == n) {
            return NOT_FOUND;
        }
        return i;
    }
} public class Main {

    static int NOT_FOUND = 99999999;

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] sArr = new int[n + 1];
        for (int i = 0; i < n; i++) {
            sArr[i] = sc.nextInt();
        }

        int q = sc.nextInt();
        int[] tArr = new int[q + 1];
        int count = 0;
        for (int i = 0; i < q; i++) {
            int x = sc.nextInt();
            tArr[i] = x;
            if (linearSearch(n, sArr, x) != NOT_FOUND) count++;
        }
        System.out.println(count);
    }

    public static int linearSearch(int n, int[] arr, int key) {
        int i = 0;
        arr[n] = key;
        while (arr[i] != key) {
            i++;
        }
        if (i == n) {
            return NOT_FOUND;
        }
        return i;
    }
} Main
import java.util.*;

public class Main {

    static int NOT_FOUND = 99999999;

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] sArr = new int[n + 1];
        for (int i = 0; i < n; i++) {
            sArr[i] = sc.nextInt();
        }

        int q = sc.nextInt();
        int[] tArr = new int[q + 1];
        int count = 0;
        for (int i = 0; i < q; i++) {
            int x = sc.nextInt();
            tArr[i] = x;
            if (linearSearch(n, sArr, x) != NOT_FOUND) count++;
        }
        System.out.println(count);
    }

    public static int linearSearch(int n, int[] arr, int key) {
        int i = 0;
        arr[n] = key;
        while (arr[i] != key) {
            i++;
        }
        if (i == n) {
            return NOT_FOUND;
        }
        return i;
    }
}

