import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

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

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());

        int[] num = new int[n];
        String[] strings = br.readLine().split("\\s");
        for (int i=0; i<strings.length; i++){
            num[i] = Integer.parseInt(strings[i]);
        }

        int q = Integer.parseInt(br.readLine());
        String[] strs = br.readLine().split("\\s");
        int sum = 0;
        for (int i=0; i<q; i++){
            if (binarySearch(num, Integer.parseInt(strs[i]))){
                sum++;
            }
        }

        System.out.println(sum);

    }

    private static boolean binarySearch(int[] num, int key) {
        
        // left??¨???????´¢?????´?????´???????´????right??????????°?????´?????????????????´?
        int left = 0;
        int right = num.length;
        
        // ?????¶???????????¶??? <
        while (left < right){
            int mid = (left+right)/2;
            if (key == num[mid]){
                return true;
            }
            else if (key < num[mid]){
                right = mid;
            }
            else {
                left = mid+1;
            }
        }

        return false;
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {

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

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());

        int[] num = new int[n];
        String[] strings = br.readLine().split("\\s");
        for (int i=0; i<strings.length; i++){
            num[i] = Integer.parseInt(strings[i]);
        }

        int q = Integer.parseInt(br.readLine());
        String[] strs = br.readLine().split("\\s");
        int sum = 0;
        for (int i=0; i<q; i++){
            if (binarySearch(num, Integer.parseInt(strs[i]))){
                sum++;
            }
        }

        System.out.println(sum);

    }

    private static boolean binarySearch(int[] num, int key) {
        
        // left??¨???????´¢?????´?????´???????´????right??????????°?????´?????????????????´?
        int left = 0;
        int right = num.length;
        
        // ?????¶???????????¶??? <
        while (left < right){
            int mid = (left+right)/2;
            if (key == num[mid]){
                return true;
            }
            else if (key < num[mid]){
                right = mid;
            }
            else {
                left = mid+1;
            }
        }

        return false;
    }
} Main public static void main(String[] args) throws IOException {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());

        int[] num = new int[n];
        String[] strings = br.readLine().split("\\s");
        for (int i=0; i<strings.length; i++){
            num[i] = Integer.parseInt(strings[i]);
        }

        int q = Integer.parseInt(br.readLine());
        String[] strs = br.readLine().split("\\s");
        int sum = 0;
        for (int i=0; i<q; i++){
            if (binarySearch(num, Integer.parseInt(strs[i]))){
                sum++;
            }
        }

        System.out.println(sum);

    } main {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());

        int[] num = new int[n];
        String[] strings = br.readLine().split("\\s");
        for (int i=0; i<strings.length; i++){
            num[i] = Integer.parseInt(strings[i]);
        }

        int q = Integer.parseInt(br.readLine());
        String[] strs = br.readLine().split("\\s");
        int sum = 0;
        for (int i=0; i<q; i++){
            if (binarySearch(num, Integer.parseInt(strs[i]))){
                sum++;
            }
        }

        System.out.println(sum);

    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int[] num = new int[n]; num new int[n] n String[] strings = br.readLine().split("\\s"); strings br.readLine().split("\\s") br.readLine().split br.readLine() br.readLine br "\\s" for (int i=0; i<strings.length; i++){
            num[i] = Integer.parseInt(strings[i]);
        } int i=0; int i=0; i 0 i<strings.length i strings.length strings strings.length i++ i++ i {
            num[i] = Integer.parseInt(strings[i]);
        } {
            num[i] = Integer.parseInt(strings[i]);
        } num[i] = Integer.parseInt(strings[i]) num[i] num i Integer.parseInt(strings[i]) Integer.parseInt Integer strings[i] strings i int q = Integer.parseInt(br.readLine()); q Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br String[] strs = br.readLine().split("\\s"); strs br.readLine().split("\\s") br.readLine().split br.readLine() br.readLine br "\\s" int sum = 0; sum 0 for (int i=0; i<q; i++){
            if (binarySearch(num, Integer.parseInt(strs[i]))){
                sum++;
            }
        } int i=0; int i=0; i 0 i<q i q i++ i++ i {
            if (binarySearch(num, Integer.parseInt(strs[i]))){
                sum++;
            }
        } {
            if (binarySearch(num, Integer.parseInt(strs[i]))){
                sum++;
            }
        } if (binarySearch(num, Integer.parseInt(strs[i]))){
                sum++;
            } binarySearch(num, Integer.parseInt(strs[i])) binarySearch num Integer.parseInt(strs[i]) Integer.parseInt Integer strs[i] strs i {
                sum++;
            } sum++ sum System.out.println(sum) System.out.println System.out System System.out sum String[] args args private static boolean binarySearch(int[] num, int key) {
        
        // left??¨???????´¢?????´?????´???????´????right??????????°?????´?????????????????´?
        int left = 0;
        int right = num.length;
        
        // ?????¶???????????¶??? <
        while (left < right){
            int mid = (left+right)/2;
            if (key == num[mid]){
                return true;
            }
            else if (key < num[mid]){
                right = mid;
            }
            else {
                left = mid+1;
            }
        }

        return false;
    } binarySearch {
        
        // left??¨???????´¢?????´?????´???????´????right??????????°?????´?????????????????´?
        int left = 0;
        int right = num.length;
        
        // ?????¶???????????¶??? <
        while (left < right){
            int mid = (left+right)/2;
            if (key == num[mid]){
                return true;
            }
            else if (key < num[mid]){
                right = mid;
            }
            else {
                left = mid+1;
            }
        }

        return false;
    } int left = 0; left 0 int right = num.length; right num.length num num.length while (left < right){
            int mid = (left+right)/2;
            if (key == num[mid]){
                return true;
            }
            else if (key < num[mid]){
                right = mid;
            }
            else {
                left = mid+1;
            }
        } left < right left right {
            int mid = (left+right)/2;
            if (key == num[mid]){
                return true;
            }
            else if (key < num[mid]){
                right = mid;
            }
            else {
                left = mid+1;
            }
        } int mid = (left+right)/2; mid (left+right)/2 (left+right) left right 2 if (key == num[mid]){
                return true;
            }
            else if (key < num[mid]){
                right = mid;
            }
            else {
                left = mid+1;
            } key == num[mid] key num[mid] num mid {
                return true;
            } return true; true if (key < num[mid]){
                right = mid;
            }
            else {
                left = mid+1;
            } key < num[mid] key num[mid] num mid {
                right = mid;
            } right = mid right mid {
                left = mid+1;
            } left = mid+1 left mid+1 mid 1 return false; false int[] num num int key key public class Main {

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

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());

        int[] num = new int[n];
        String[] strings = br.readLine().split("\\s");
        for (int i=0; i<strings.length; i++){
            num[i] = Integer.parseInt(strings[i]);
        }

        int q = Integer.parseInt(br.readLine());
        String[] strs = br.readLine().split("\\s");
        int sum = 0;
        for (int i=0; i<q; i++){
            if (binarySearch(num, Integer.parseInt(strs[i]))){
                sum++;
            }
        }

        System.out.println(sum);

    }

    private static boolean binarySearch(int[] num, int key) {
        
        // left??¨???????´¢?????´?????´???????´????right??????????°?????´?????????????????´?
        int left = 0;
        int right = num.length;
        
        // ?????¶???????????¶??? <
        while (left < right){
            int mid = (left+right)/2;
            if (key == num[mid]){
                return true;
            }
            else if (key < num[mid]){
                right = mid;
            }
            else {
                left = mid+1;
            }
        }

        return false;
    }
} public class Main {

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

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());

        int[] num = new int[n];
        String[] strings = br.readLine().split("\\s");
        for (int i=0; i<strings.length; i++){
            num[i] = Integer.parseInt(strings[i]);
        }

        int q = Integer.parseInt(br.readLine());
        String[] strs = br.readLine().split("\\s");
        int sum = 0;
        for (int i=0; i<q; i++){
            if (binarySearch(num, Integer.parseInt(strs[i]))){
                sum++;
            }
        }

        System.out.println(sum);

    }

    private static boolean binarySearch(int[] num, int key) {
        
        // left??¨???????´¢?????´?????´???????´????right??????????°?????´?????????????????´?
        int left = 0;
        int right = num.length;
        
        // ?????¶???????????¶??? <
        while (left < right){
            int mid = (left+right)/2;
            if (key == num[mid]){
                return true;
            }
            else if (key < num[mid]){
                right = mid;
            }
            else {
                left = mid+1;
            }
        }

        return false;
    }
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

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

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());

        int[] num = new int[n];
        String[] strings = br.readLine().split("\\s");
        for (int i=0; i<strings.length; i++){
            num[i] = Integer.parseInt(strings[i]);
        }

        int q = Integer.parseInt(br.readLine());
        String[] strs = br.readLine().split("\\s");
        int sum = 0;
        for (int i=0; i<q; i++){
            if (binarySearch(num, Integer.parseInt(strs[i]))){
                sum++;
            }
        }

        System.out.println(sum);

    }

    private static boolean binarySearch(int[] num, int key) {
        
        // left??¨???????´¢?????´?????´???????´????right??????????°?????´?????????????????´?
        int left = 0;
        int right = num.length;
        
        // ?????¶???????????¶??? <
        while (left < right){
            int mid = (left+right)/2;
            if (key == num[mid]){
                return true;
            }
            else if (key < num[mid]){
                right = mid;
            }
            else {
                left = mid+1;
            }
        }

        return false;
    }
}