import java.util.Scanner;

public class Main {
    public boolean binarySearch(int[] s, int n, int key) {
        int left = 0;
        int right = n;
        int mid;
        while (left < right) {  // 表示搜索范围不为空
            mid = (left + right) / 2;
            if(key == s[mid]) return true;  // 发现 key
            else if(key > s[mid]) left = mid + 1;  // 搜索后半部分
            else right = mid;  // 搜索前半部分
        }
        return false;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] s = new int[n + 1];
        for (int i = 0; i < n; i++) {
            s[i] = in.nextInt();
        }

        int q = in.nextInt();

        Main test = new Main();
        int sum = 0;

        for (int i = 0; i < q; i++) {
            int key = in.nextInt();
            if (test.binarySearch(s, n, key)) sum++;
        }
        System.out.println(sum);
    }
}
 import java.util.Scanner; Scanner java.util public class Main {
    public boolean binarySearch(int[] s, int n, int key) {
        int left = 0;
        int right = n;
        int mid;
        while (left < right) {  // 表示搜索范围不为空
            mid = (left + right) / 2;
            if(key == s[mid]) return true;  // 发现 key
            else if(key > s[mid]) left = mid + 1;  // 搜索后半部分
            else right = mid;  // 搜索前半部分
        }
        return false;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] s = new int[n + 1];
        for (int i = 0; i < n; i++) {
            s[i] = in.nextInt();
        }

        int q = in.nextInt();

        Main test = new Main();
        int sum = 0;

        for (int i = 0; i < q; i++) {
            int key = in.nextInt();
            if (test.binarySearch(s, n, key)) sum++;
        }
        System.out.println(sum);
    }
} Main public boolean binarySearch(int[] s, int n, int key) {
        int left = 0;
        int right = n;
        int mid;
        while (left < right) {  // 表示搜索范围不为空
            mid = (left + right) / 2;
            if(key == s[mid]) return true;  // 发现 key
            else if(key > s[mid]) left = mid + 1;  // 搜索后半部分
            else right = mid;  // 搜索前半部分
        }
        return false;
    } binarySearch {
        int left = 0;
        int right = n;
        int mid;
        while (left < right) {  // 表示搜索范围不为空
            mid = (left + right) / 2;
            if(key == s[mid]) return true;  // 发现 key
            else if(key > s[mid]) left = mid + 1;  // 搜索后半部分
            else right = mid;  // 搜索前半部分
        }
        return false;
    } int left = 0; left 0 int right = n; right n int mid; mid while (left < right) {  // 表示搜索范围不为空
            mid = (left + right) / 2;
            if(key == s[mid]) return true;  // 发现 key
            else if(key > s[mid]) left = mid + 1;  // 搜索后半部分
            else right = mid;  // 搜索前半部分
        } left < right left right {  // 表示搜索范围不为空
            mid = (left + right) / 2;
            if(key == s[mid]) return true;  // 发现 key
            else if(key > s[mid]) left = mid + 1;  // 搜索后半部分
            else right = mid;  // 搜索前半部分
        } mid = (left + right) / 2 mid (left + right) / 2 (left + right) left right 2 if(key == s[mid]) return true;  // 发现 key
            else if(key > s[mid]) left = mid + 1;  // 搜索后半部分
            else right = mid;  // 搜索前半部分 key == s[mid] key s[mid] s mid return true;  // 发现 key true if(key > s[mid]) left = mid + 1;  // 搜索后半部分
            else right = mid;  // 搜索前半部分 key > s[mid] key s[mid] s mid left = mid + 1 left mid + 1 mid 1 right = mid right mid return false; false int[] s s int n n int key key public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] s = new int[n + 1];
        for (int i = 0; i < n; i++) {
            s[i] = in.nextInt();
        }

        int q = in.nextInt();

        Main test = new Main();
        int sum = 0;

        for (int i = 0; i < q; i++) {
            int key = in.nextInt();
            if (test.binarySearch(s, n, key)) sum++;
        }
        System.out.println(sum);
    } main {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] s = new int[n + 1];
        for (int i = 0; i < n; i++) {
            s[i] = in.nextInt();
        }

        int q = in.nextInt();

        Main test = new Main();
        int sum = 0;

        for (int i = 0; i < q; i++) {
            int key = in.nextInt();
            if (test.binarySearch(s, n, key)) sum++;
        }
        System.out.println(sum);
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) int n = in.nextInt(); n in.nextInt() in.nextInt in int[] s = new int[n + 1]; s new int[n + 1] n + 1 n 1 for (int i = 0; i < n; i++) {
            s[i] = in.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            s[i] = in.nextInt();
        } {
            s[i] = in.nextInt();
        } s[i] = in.nextInt() s[i] s i in.nextInt() in.nextInt in int q = in.nextInt(); q in.nextInt() in.nextInt in Main test = new Main(); test new Main() int sum = 0; sum 0 for (int i = 0; i < q; i++) {
            int key = in.nextInt();
            if (test.binarySearch(s, n, key)) sum++;
        } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
            int key = in.nextInt();
            if (test.binarySearch(s, n, key)) sum++;
        } {
            int key = in.nextInt();
            if (test.binarySearch(s, n, key)) sum++;
        } int key = in.nextInt(); key in.nextInt() in.nextInt in if (test.binarySearch(s, n, key)) sum++; test.binarySearch(s, n, key) test.binarySearch test s n key sum++ sum System.out.println(sum) System.out.println System.out System System.out sum String[] args args public class Main {
    public boolean binarySearch(int[] s, int n, int key) {
        int left = 0;
        int right = n;
        int mid;
        while (left < right) {  // 表示搜索范围不为空
            mid = (left + right) / 2;
            if(key == s[mid]) return true;  // 发现 key
            else if(key > s[mid]) left = mid + 1;  // 搜索后半部分
            else right = mid;  // 搜索前半部分
        }
        return false;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] s = new int[n + 1];
        for (int i = 0; i < n; i++) {
            s[i] = in.nextInt();
        }

        int q = in.nextInt();

        Main test = new Main();
        int sum = 0;

        for (int i = 0; i < q; i++) {
            int key = in.nextInt();
            if (test.binarySearch(s, n, key)) sum++;
        }
        System.out.println(sum);
    }
} public class Main {
    public boolean binarySearch(int[] s, int n, int key) {
        int left = 0;
        int right = n;
        int mid;
        while (left < right) {  // 表示搜索范围不为空
            mid = (left + right) / 2;
            if(key == s[mid]) return true;  // 发现 key
            else if(key > s[mid]) left = mid + 1;  // 搜索后半部分
            else right = mid;  // 搜索前半部分
        }
        return false;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] s = new int[n + 1];
        for (int i = 0; i < n; i++) {
            s[i] = in.nextInt();
        }

        int q = in.nextInt();

        Main test = new Main();
        int sum = 0;

        for (int i = 0; i < q; i++) {
            int key = in.nextInt();
            if (test.binarySearch(s, n, key)) sum++;
        }
        System.out.println(sum);
    }
} Main
import java.util.Scanner;

public class Main {
    public boolean binarySearch(int[] s, int n, int key) {
        int left = 0;
        int right = n;
        int mid;
        while (left < right) {  // 表示搜索范围不为空
            mid = (left + right) / 2;
            if(key == s[mid]) return true;  // 发现 key
            else if(key > s[mid]) left = mid + 1;  // 搜索后半部分
            else right = mid;  // 搜索前半部分
        }
        return false;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] s = new int[n + 1];
        for (int i = 0; i < n; i++) {
            s[i] = in.nextInt();
        }

        int q = in.nextInt();

        Main test = new Main();
        int sum = 0;

        for (int i = 0; i < q; i++) {
            int key = in.nextInt();
            if (test.binarySearch(s, n, key)) sum++;
        }
        System.out.println(sum);
    }
}

