import java.util.*;

class Main {
    public static void main(String[] args) {
        new Main().main();
    }

    public void main() {
        Scanner scanner = new Scanner(System.in);

        int sNum = Integer.parseInt(scanner.nextLine());
        String[] sLine = scanner.nextLine().split(" ", sNum);
        int[] s = new int[sNum];
        for (int i = 0; i < sNum; i++) {
            s[i] = Integer.parseInt(sLine[i]);
        }

        int tNum = Integer.parseInt(scanner.nextLine());
        String[] tLine = scanner.nextLine().split(" ", tNum);

        int result = 0;
        for (int i = 0; i < tNum; i++) {
            int t = Integer.parseInt(tLine[i]);
            if (this.binarySearch(t, s)) {
                result++;
            }
        }
        System.out.println(result);
    }

    private boolean binarySearch(int key, int[] arr) {
        int left = 0;
        int right = arr.length - 1;

        while (true) {
            int middle = (left + right) / 2;
            if (middle == left || middle == right) {
                return key == arr[left] || key == arr[right];
            }

            if (key == arr[middle]) {
                return true;
            } else if (key < arr[middle]) {
                right = middle;
            } else {
                left = middle;
            }
        }
    }
}
 import java.util.*; util.* java class Main {
    public static void main(String[] args) {
        new Main().main();
    }

    public void main() {
        Scanner scanner = new Scanner(System.in);

        int sNum = Integer.parseInt(scanner.nextLine());
        String[] sLine = scanner.nextLine().split(" ", sNum);
        int[] s = new int[sNum];
        for (int i = 0; i < sNum; i++) {
            s[i] = Integer.parseInt(sLine[i]);
        }

        int tNum = Integer.parseInt(scanner.nextLine());
        String[] tLine = scanner.nextLine().split(" ", tNum);

        int result = 0;
        for (int i = 0; i < tNum; i++) {
            int t = Integer.parseInt(tLine[i]);
            if (this.binarySearch(t, s)) {
                result++;
            }
        }
        System.out.println(result);
    }

    private boolean binarySearch(int key, int[] arr) {
        int left = 0;
        int right = arr.length - 1;

        while (true) {
            int middle = (left + right) / 2;
            if (middle == left || middle == right) {
                return key == arr[left] || key == arr[right];
            }

            if (key == arr[middle]) {
                return true;
            } else if (key < arr[middle]) {
                right = middle;
            } else {
                left = middle;
            }
        }
    }
} Main public static void main(String[] args) {
        new Main().main();
    } main {
        new Main().main();
    } new Main().main() new Main().main new Main() String[] args args public void main() {
        Scanner scanner = new Scanner(System.in);

        int sNum = Integer.parseInt(scanner.nextLine());
        String[] sLine = scanner.nextLine().split(" ", sNum);
        int[] s = new int[sNum];
        for (int i = 0; i < sNum; i++) {
            s[i] = Integer.parseInt(sLine[i]);
        }

        int tNum = Integer.parseInt(scanner.nextLine());
        String[] tLine = scanner.nextLine().split(" ", tNum);

        int result = 0;
        for (int i = 0; i < tNum; i++) {
            int t = Integer.parseInt(tLine[i]);
            if (this.binarySearch(t, s)) {
                result++;
            }
        }
        System.out.println(result);
    } main {
        Scanner scanner = new Scanner(System.in);

        int sNum = Integer.parseInt(scanner.nextLine());
        String[] sLine = scanner.nextLine().split(" ", sNum);
        int[] s = new int[sNum];
        for (int i = 0; i < sNum; i++) {
            s[i] = Integer.parseInt(sLine[i]);
        }

        int tNum = Integer.parseInt(scanner.nextLine());
        String[] tLine = scanner.nextLine().split(" ", tNum);

        int result = 0;
        for (int i = 0; i < tNum; i++) {
            int t = Integer.parseInt(tLine[i]);
            if (this.binarySearch(t, s)) {
                result++;
            }
        }
        System.out.println(result);
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int sNum = Integer.parseInt(scanner.nextLine()); sNum Integer.parseInt(scanner.nextLine()) Integer.parseInt Integer scanner.nextLine() scanner.nextLine scanner String[] sLine = scanner.nextLine().split(" ", sNum); sLine scanner.nextLine().split(" ", sNum) scanner.nextLine().split scanner.nextLine() scanner.nextLine scanner " " sNum int[] s = new int[sNum]; s new int[sNum] sNum for (int i = 0; i < sNum; i++) {
            s[i] = Integer.parseInt(sLine[i]);
        } int i = 0; int i = 0; i 0 i < sNum i sNum i++ i++ i {
            s[i] = Integer.parseInt(sLine[i]);
        } {
            s[i] = Integer.parseInt(sLine[i]);
        } s[i] = Integer.parseInt(sLine[i]) s[i] s i Integer.parseInt(sLine[i]) Integer.parseInt Integer sLine[i] sLine i int tNum = Integer.parseInt(scanner.nextLine()); tNum Integer.parseInt(scanner.nextLine()) Integer.parseInt Integer scanner.nextLine() scanner.nextLine scanner String[] tLine = scanner.nextLine().split(" ", tNum); tLine scanner.nextLine().split(" ", tNum) scanner.nextLine().split scanner.nextLine() scanner.nextLine scanner " " tNum int result = 0; result 0 for (int i = 0; i < tNum; i++) {
            int t = Integer.parseInt(tLine[i]);
            if (this.binarySearch(t, s)) {
                result++;
            }
        } int i = 0; int i = 0; i 0 i < tNum i tNum i++ i++ i {
            int t = Integer.parseInt(tLine[i]);
            if (this.binarySearch(t, s)) {
                result++;
            }
        } {
            int t = Integer.parseInt(tLine[i]);
            if (this.binarySearch(t, s)) {
                result++;
            }
        } int t = Integer.parseInt(tLine[i]); t Integer.parseInt(tLine[i]) Integer.parseInt Integer tLine[i] tLine i if (this.binarySearch(t, s)) {
                result++;
            } this.binarySearch(t, s) this.binarySearch this t s {
                result++;
            } result++ result System.out.println(result) System.out.println System.out System System.out result private boolean binarySearch(int key, int[] arr) {
        int left = 0;
        int right = arr.length - 1;

        while (true) {
            int middle = (left + right) / 2;
            if (middle == left || middle == right) {
                return key == arr[left] || key == arr[right];
            }

            if (key == arr[middle]) {
                return true;
            } else if (key < arr[middle]) {
                right = middle;
            } else {
                left = middle;
            }
        }
    } binarySearch {
        int left = 0;
        int right = arr.length - 1;

        while (true) {
            int middle = (left + right) / 2;
            if (middle == left || middle == right) {
                return key == arr[left] || key == arr[right];
            }

            if (key == arr[middle]) {
                return true;
            } else if (key < arr[middle]) {
                right = middle;
            } else {
                left = middle;
            }
        }
    } int left = 0; left 0 int right = arr.length - 1; right arr.length - 1 arr.length arr arr.length 1 while (true) {
            int middle = (left + right) / 2;
            if (middle == left || middle == right) {
                return key == arr[left] || key == arr[right];
            }

            if (key == arr[middle]) {
                return true;
            } else if (key < arr[middle]) {
                right = middle;
            } else {
                left = middle;
            }
        } true {
            int middle = (left + right) / 2;
            if (middle == left || middle == right) {
                return key == arr[left] || key == arr[right];
            }

            if (key == arr[middle]) {
                return true;
            } else if (key < arr[middle]) {
                right = middle;
            } else {
                left = middle;
            }
        } int middle = (left + right) / 2; middle (left + right) / 2 (left + right) left right 2 if (middle == left || middle == right) {
                return key == arr[left] || key == arr[right];
            } middle == left || middle == right middle == left middle left middle == right middle right {
                return key == arr[left] || key == arr[right];
            } return key == arr[left] || key == arr[right]; key == arr[left] || key == arr[right] key == arr[left] key arr[left] arr left key == arr[right] key arr[right] arr right if (key == arr[middle]) {
                return true;
            } else if (key < arr[middle]) {
                right = middle;
            } else {
                left = middle;
            } key == arr[middle] key arr[middle] arr middle {
                return true;
            } return true; true if (key < arr[middle]) {
                right = middle;
            } else {
                left = middle;
            } key < arr[middle] key arr[middle] arr middle {
                right = middle;
            } right = middle right middle {
                left = middle;
            } left = middle left middle int key key int[] arr arr
import java.util.*;

class Main {
    public static void main(String[] args) {
        new Main().main();
    }

    public void main() {
        Scanner scanner = new Scanner(System.in);

        int sNum = Integer.parseInt(scanner.nextLine());
        String[] sLine = scanner.nextLine().split(" ", sNum);
        int[] s = new int[sNum];
        for (int i = 0; i < sNum; i++) {
            s[i] = Integer.parseInt(sLine[i]);
        }

        int tNum = Integer.parseInt(scanner.nextLine());
        String[] tLine = scanner.nextLine().split(" ", tNum);

        int result = 0;
        for (int i = 0; i < tNum; i++) {
            int t = Integer.parseInt(tLine[i]);
            if (this.binarySearch(t, s)) {
                result++;
            }
        }
        System.out.println(result);
    }

    private boolean binarySearch(int key, int[] arr) {
        int left = 0;
        int right = arr.length - 1;

        while (true) {
            int middle = (left + right) / 2;
            if (middle == left || middle == right) {
                return key == arr[left] || key == arr[right];
            }

            if (key == arr[middle]) {
                return true;
            } else if (key < arr[middle]) {
                right = middle;
            } else {
                left = middle;
            }
        }
    }
}

