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

class Main {

    static boolean binarySearch(int[] a, int key, int begin, int end){     
        if(begin >= end){
            if(a[begin] != key){
                return false;
            }
        }

        int med = (begin + end) / 2;
        if (a[med] == key) {
            return true;
        } else if (a[med] > key) {
            return binarySearch(a, key, begin, med - 1);
        } else if (a[med] < key) {
            return binarySearch(a, key, med + 1, end);
        }

        return false; // unreachable
    }

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        int result = 0;

        int n = Integer.parseInt(br.readLine());
        int[] S = new int[n];
        String[] inputs = br.readLine().split(" ");
        for (int i = 0; i < n; i++) {
            S[i] = Integer.parseInt(inputs[i]);
        }

        int q = Integer.parseInt(br.readLine());
        String[] inputt = br.readLine().split(" ");
        for (String str : inputt) {
            if (binarySearch(S, Integer.parseInt(str), 0, n - 1)) {
                result++;
            }
        }

        System.out.println(result);
    }
} import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.BufferedReader; BufferedReader java.io class Main {

    static boolean binarySearch(int[] a, int key, int begin, int end){     
        if(begin >= end){
            if(a[begin] != key){
                return false;
            }
        }

        int med = (begin + end) / 2;
        if (a[med] == key) {
            return true;
        } else if (a[med] > key) {
            return binarySearch(a, key, begin, med - 1);
        } else if (a[med] < key) {
            return binarySearch(a, key, med + 1, end);
        }

        return false; // unreachable
    }

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        int result = 0;

        int n = Integer.parseInt(br.readLine());
        int[] S = new int[n];
        String[] inputs = br.readLine().split(" ");
        for (int i = 0; i < n; i++) {
            S[i] = Integer.parseInt(inputs[i]);
        }

        int q = Integer.parseInt(br.readLine());
        String[] inputt = br.readLine().split(" ");
        for (String str : inputt) {
            if (binarySearch(S, Integer.parseInt(str), 0, n - 1)) {
                result++;
            }
        }

        System.out.println(result);
    }
} Main static boolean binarySearch(int[] a, int key, int begin, int end){     
        if(begin >= end){
            if(a[begin] != key){
                return false;
            }
        }

        int med = (begin + end) / 2;
        if (a[med] == key) {
            return true;
        } else if (a[med] > key) {
            return binarySearch(a, key, begin, med - 1);
        } else if (a[med] < key) {
            return binarySearch(a, key, med + 1, end);
        }

        return false; // unreachable
    } binarySearch {     
        if(begin >= end){
            if(a[begin] != key){
                return false;
            }
        }

        int med = (begin + end) / 2;
        if (a[med] == key) {
            return true;
        } else if (a[med] > key) {
            return binarySearch(a, key, begin, med - 1);
        } else if (a[med] < key) {
            return binarySearch(a, key, med + 1, end);
        }

        return false; // unreachable
    } if(begin >= end){
            if(a[begin] != key){
                return false;
            }
        } begin >= end begin end {
            if(a[begin] != key){
                return false;
            }
        } if(a[begin] != key){
                return false;
            } a[begin] != key a[begin] a begin key {
                return false;
            } return false; false int med = (begin + end) / 2; med (begin + end) / 2 (begin + end) begin end 2 if (a[med] == key) {
            return true;
        } else if (a[med] > key) {
            return binarySearch(a, key, begin, med - 1);
        } else if (a[med] < key) {
            return binarySearch(a, key, med + 1, end);
        } a[med] == key a[med] a med key {
            return true;
        } return true; true if (a[med] > key) {
            return binarySearch(a, key, begin, med - 1);
        } else if (a[med] < key) {
            return binarySearch(a, key, med + 1, end);
        } a[med] > key a[med] a med key {
            return binarySearch(a, key, begin, med - 1);
        } return binarySearch(a, key, begin, med - 1); binarySearch(a, key, begin, med - 1) binarySearch a key begin med - 1 med 1 if (a[med] < key) {
            return binarySearch(a, key, med + 1, end);
        } a[med] < key a[med] a med key {
            return binarySearch(a, key, med + 1, end);
        } return binarySearch(a, key, med + 1, end); binarySearch(a, key, med + 1, end) binarySearch a key med + 1 med 1 end return false; // unreachable false int[] a a int key key int begin begin int end end public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        int result = 0;

        int n = Integer.parseInt(br.readLine());
        int[] S = new int[n];
        String[] inputs = br.readLine().split(" ");
        for (int i = 0; i < n; i++) {
            S[i] = Integer.parseInt(inputs[i]);
        }

        int q = Integer.parseInt(br.readLine());
        String[] inputt = br.readLine().split(" ");
        for (String str : inputt) {
            if (binarySearch(S, Integer.parseInt(str), 0, n - 1)) {
                result++;
            }
        }

        System.out.println(result);
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        int result = 0;

        int n = Integer.parseInt(br.readLine());
        int[] S = new int[n];
        String[] inputs = br.readLine().split(" ");
        for (int i = 0; i < n; i++) {
            S[i] = Integer.parseInt(inputs[i]);
        }

        int q = Integer.parseInt(br.readLine());
        String[] inputt = br.readLine().split(" ");
        for (String str : inputt) {
            if (binarySearch(S, Integer.parseInt(str), 0, n - 1)) {
                result++;
            }
        }

        System.out.println(result);
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int result = 0; result 0 int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int[] S = new int[n]; S new int[n] n String[] inputs = br.readLine().split(" "); inputs br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " for (int i = 0; i < n; i++) {
            S[i] = Integer.parseInt(inputs[i]);
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            S[i] = Integer.parseInt(inputs[i]);
        } {
            S[i] = Integer.parseInt(inputs[i]);
        } S[i] = Integer.parseInt(inputs[i]) S[i] S i Integer.parseInt(inputs[i]) Integer.parseInt Integer inputs[i] inputs i int q = Integer.parseInt(br.readLine()); q Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br String[] inputt = br.readLine().split(" "); inputt br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " for (String str : inputt) {
            if (binarySearch(S, Integer.parseInt(str), 0, n - 1)) {
                result++;
            }
        } String str inputt {
            if (binarySearch(S, Integer.parseInt(str), 0, n - 1)) {
                result++;
            }
        } {
            if (binarySearch(S, Integer.parseInt(str), 0, n - 1)) {
                result++;
            }
        } if (binarySearch(S, Integer.parseInt(str), 0, n - 1)) {
                result++;
            } binarySearch(S, Integer.parseInt(str), 0, n - 1) binarySearch S Integer.parseInt(str) Integer.parseInt Integer str 0 n - 1 n 1 {
                result++;
            } result++ result System.out.println(result) System.out.println System.out System System.out result String[] args args
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.BufferedReader;

class Main {

    static boolean binarySearch(int[] a, int key, int begin, int end){     
        if(begin >= end){
            if(a[begin] != key){
                return false;
            }
        }

        int med = (begin + end) / 2;
        if (a[med] == key) {
            return true;
        } else if (a[med] > key) {
            return binarySearch(a, key, begin, med - 1);
        } else if (a[med] < key) {
            return binarySearch(a, key, med + 1, end);
        }

        return false; // unreachable
    }

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        int result = 0;

        int n = Integer.parseInt(br.readLine());
        int[] S = new int[n];
        String[] inputs = br.readLine().split(" ");
        for (int i = 0; i < n; i++) {
            S[i] = Integer.parseInt(inputs[i]);
        }

        int q = Integer.parseInt(br.readLine());
        String[] inputt = br.readLine().split(" ");
        for (String str : inputt) {
            if (binarySearch(S, Integer.parseInt(str), 0, n - 1)) {
                result++;
            }
        }

        System.out.println(result);
    }
}
