import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.*;
import java.awt.Point;

public class Main {
    // static int INF = (1 << 30) - 1;
    // static long L_INF = (1L << 62) - 1;
    // static long MOD = (long) 1e9 + 7;

    static class Solver {
        int n;
        int[] S;
        int q;
        int[] T;

        boolean binarySearch(int[] arr, int v) {
            int left = 0;
            int right = arr.length;
            while (left < right) {
                int mid = (left + right) / 2;
                if (arr[mid] == v) {
                    return true;
                } else if (arr[mid] < v) {
                    left = mid + 1;
                } else {
                    right = mid;
                }
            }
            return false;
        }

        // write your code
        void solve(InputReader in, PrintWriter out) {
            n = in.nextInt();
            S = new int[n];
            for (int i = 0; i < n; i++) {
                S[i] = in.nextInt();
            }
            q = in.nextInt();
            T = new int[q];
            for (int i = 0; i < q; i++) {
                T[i] = in.nextInt();
            }

            int ans = 0;
            for (int i = 0; i < q; i++) {
                if (binarySearch(S, T[i])) {
                    ans++;
                }
            }
            out.println(ans);
        }

        void debug(Object... os) {
            System.err.println(Arrays.deepToString(os));
        }
    }

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Solver solver = new Solver();
        solver.solve(in, out);
        out.close();
    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }
    }
}
 import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.OutputStream; OutputStream java.io import java.io.PrintWriter; PrintWriter java.io import java.util.*; util.* java import java.awt.Point; Point java.awt public class Main {
    // static int INF = (1 << 30) - 1;
    // static long L_INF = (1L << 62) - 1;
    // static long MOD = (long) 1e9 + 7;

    static class Solver {
        int n;
        int[] S;
        int q;
        int[] T;

        boolean binarySearch(int[] arr, int v) {
            int left = 0;
            int right = arr.length;
            while (left < right) {
                int mid = (left + right) / 2;
                if (arr[mid] == v) {
                    return true;
                } else if (arr[mid] < v) {
                    left = mid + 1;
                } else {
                    right = mid;
                }
            }
            return false;
        }

        // write your code
        void solve(InputReader in, PrintWriter out) {
            n = in.nextInt();
            S = new int[n];
            for (int i = 0; i < n; i++) {
                S[i] = in.nextInt();
            }
            q = in.nextInt();
            T = new int[q];
            for (int i = 0; i < q; i++) {
                T[i] = in.nextInt();
            }

            int ans = 0;
            for (int i = 0; i < q; i++) {
                if (binarySearch(S, T[i])) {
                    ans++;
                }
            }
            out.println(ans);
        }

        void debug(Object... os) {
            System.err.println(Arrays.deepToString(os));
        }
    }

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Solver solver = new Solver();
        solver.solve(in, out);
        out.close();
    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }
    }
} Main public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Solver solver = new Solver();
        solver.solve(in, out);
        out.close();
    } main {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Solver solver = new Solver();
        solver.solve(in, out);
        out.close();
    } InputStream inputStream = System.in; inputStream System.in System System.in OutputStream outputStream = System.out; outputStream System.out System System.out InputReader in = new InputReader(inputStream); in new InputReader(inputStream) PrintWriter out = new PrintWriter(outputStream); out new PrintWriter(outputStream) Solver solver = new Solver(); solver new Solver() solver.solve(in, out) solver.solve solver in out out.close() out.close out String[] args args static class Solver {
        int n;
        int[] S;
        int q;
        int[] T;

        boolean binarySearch(int[] arr, int v) {
            int left = 0;
            int right = arr.length;
            while (left < right) {
                int mid = (left + right) / 2;
                if (arr[mid] == v) {
                    return true;
                } else if (arr[mid] < v) {
                    left = mid + 1;
                } else {
                    right = mid;
                }
            }
            return false;
        }

        // write your code
        void solve(InputReader in, PrintWriter out) {
            n = in.nextInt();
            S = new int[n];
            for (int i = 0; i < n; i++) {
                S[i] = in.nextInt();
            }
            q = in.nextInt();
            T = new int[q];
            for (int i = 0; i < q; i++) {
                T[i] = in.nextInt();
            }

            int ans = 0;
            for (int i = 0; i < q; i++) {
                if (binarySearch(S, T[i])) {
                    ans++;
                }
            }
            out.println(ans);
        }

        void debug(Object... os) {
            System.err.println(Arrays.deepToString(os));
        }
    } Solver int n; n int[] S; S int q; q int[] T; T boolean binarySearch(int[] arr, int v) {
            int left = 0;
            int right = arr.length;
            while (left < right) {
                int mid = (left + right) / 2;
                if (arr[mid] == v) {
                    return true;
                } else if (arr[mid] < v) {
                    left = mid + 1;
                } else {
                    right = mid;
                }
            }
            return false;
        } binarySearch {
            int left = 0;
            int right = arr.length;
            while (left < right) {
                int mid = (left + right) / 2;
                if (arr[mid] == v) {
                    return true;
                } else if (arr[mid] < v) {
                    left = mid + 1;
                } else {
                    right = mid;
                }
            }
            return false;
        } int left = 0; left 0 int right = arr.length; right arr.length arr arr.length while (left < right) {
                int mid = (left + right) / 2;
                if (arr[mid] == v) {
                    return true;
                } else if (arr[mid] < v) {
                    left = mid + 1;
                } else {
                    right = mid;
                }
            } left < right left right {
                int mid = (left + right) / 2;
                if (arr[mid] == v) {
                    return true;
                } else if (arr[mid] < v) {
                    left = mid + 1;
                } else {
                    right = mid;
                }
            } int mid = (left + right) / 2; mid (left + right) / 2 (left + right) left right 2 if (arr[mid] == v) {
                    return true;
                } else if (arr[mid] < v) {
                    left = mid + 1;
                } else {
                    right = mid;
                } arr[mid] == v arr[mid] arr mid v {
                    return true;
                } return true; true if (arr[mid] < v) {
                    left = mid + 1;
                } else {
                    right = mid;
                } arr[mid] < v arr[mid] arr mid v {
                    left = mid + 1;
                } left = mid + 1 left mid + 1 mid 1 {
                    right = mid;
                } right = mid right mid return false; false int[] arr arr int v v // write your code
        void solve(InputReader in, PrintWriter out) {
            n = in.nextInt();
            S = new int[n];
            for (int i = 0; i < n; i++) {
                S[i] = in.nextInt();
            }
            q = in.nextInt();
            T = new int[q];
            for (int i = 0; i < q; i++) {
                T[i] = in.nextInt();
            }

            int ans = 0;
            for (int i = 0; i < q; i++) {
                if (binarySearch(S, T[i])) {
                    ans++;
                }
            }
            out.println(ans);
        } solve {
            n = in.nextInt();
            S = new int[n];
            for (int i = 0; i < n; i++) {
                S[i] = in.nextInt();
            }
            q = in.nextInt();
            T = new int[q];
            for (int i = 0; i < q; i++) {
                T[i] = in.nextInt();
            }

            int ans = 0;
            for (int i = 0; i < q; i++) {
                if (binarySearch(S, T[i])) {
                    ans++;
                }
            }
            out.println(ans);
        } n = in.nextInt() n in.nextInt() in.nextInt in S = new int[n] S new int[n] n 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 q = in.nextInt() q in.nextInt() in.nextInt in T = new int[q] T new int[q] q for (int i = 0; i < q; i++) {
                T[i] = in.nextInt();
            } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
                T[i] = in.nextInt();
            } {
                T[i] = in.nextInt();
            } T[i] = in.nextInt() T[i] T i in.nextInt() in.nextInt in int ans = 0; ans 0 for (int i = 0; i < q; i++) {
                if (binarySearch(S, T[i])) {
                    ans++;
                }
            } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
                if (binarySearch(S, T[i])) {
                    ans++;
                }
            } {
                if (binarySearch(S, T[i])) {
                    ans++;
                }
            } if (binarySearch(S, T[i])) {
                    ans++;
                } binarySearch(S, T[i]) binarySearch S T[i] T i {
                    ans++;
                } ans++ ans out.println(ans) out.println out ans InputReader in in PrintWriter out out void debug(Object... os) {
            System.err.println(Arrays.deepToString(os));
        } debug {
            System.err.println(Arrays.deepToString(os));
        } System.err.println(Arrays.deepToString(os)) System.err.println System.err System System.err Arrays.deepToString(os) Arrays.deepToString Arrays os Object... os os static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }
    } InputReader BufferedReader reader; reader StringTokenizer tokenizer; tokenizer InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        } InputReader {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        } reader = new BufferedReader(new InputStreamReader(stream), 32768) reader new BufferedReader(new InputStreamReader(stream), 32768) tokenizer = null tokenizer null InputStream stream stream String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        } next {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        } while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            } tokenizer == null || !tokenizer.hasMoreTokens() tokenizer == null tokenizer null !tokenizer.hasMoreTokens() tokenizer.hasMoreTokens() tokenizer.hasMoreTokens tokenizer {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            } try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                } IOException e {
                    throw new RuntimeException(e);
                } throw new RuntimeException(e); new RuntimeException(e) {
                    tokenizer = new StringTokenizer(reader.readLine());
                } tokenizer = new StringTokenizer(reader.readLine()) tokenizer new StringTokenizer(reader.readLine()) return tokenizer.nextToken(); tokenizer.nextToken() tokenizer.nextToken tokenizer int nextInt() {
            return Integer.parseInt(next());
        } nextInt {
            return Integer.parseInt(next());
        } return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next long nextLong() {
            return Long.parseLong(next());
        } nextLong {
            return Long.parseLong(next());
        } return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next public class Main {
    // static int INF = (1 << 30) - 1;
    // static long L_INF = (1L << 62) - 1;
    // static long MOD = (long) 1e9 + 7;

    static class Solver {
        int n;
        int[] S;
        int q;
        int[] T;

        boolean binarySearch(int[] arr, int v) {
            int left = 0;
            int right = arr.length;
            while (left < right) {
                int mid = (left + right) / 2;
                if (arr[mid] == v) {
                    return true;
                } else if (arr[mid] < v) {
                    left = mid + 1;
                } else {
                    right = mid;
                }
            }
            return false;
        }

        // write your code
        void solve(InputReader in, PrintWriter out) {
            n = in.nextInt();
            S = new int[n];
            for (int i = 0; i < n; i++) {
                S[i] = in.nextInt();
            }
            q = in.nextInt();
            T = new int[q];
            for (int i = 0; i < q; i++) {
                T[i] = in.nextInt();
            }

            int ans = 0;
            for (int i = 0; i < q; i++) {
                if (binarySearch(S, T[i])) {
                    ans++;
                }
            }
            out.println(ans);
        }

        void debug(Object... os) {
            System.err.println(Arrays.deepToString(os));
        }
    }

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Solver solver = new Solver();
        solver.solve(in, out);
        out.close();
    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }
    }
} public class Main {
    // static int INF = (1 << 30) - 1;
    // static long L_INF = (1L << 62) - 1;
    // static long MOD = (long) 1e9 + 7;

    static class Solver {
        int n;
        int[] S;
        int q;
        int[] T;

        boolean binarySearch(int[] arr, int v) {
            int left = 0;
            int right = arr.length;
            while (left < right) {
                int mid = (left + right) / 2;
                if (arr[mid] == v) {
                    return true;
                } else if (arr[mid] < v) {
                    left = mid + 1;
                } else {
                    right = mid;
                }
            }
            return false;
        }

        // write your code
        void solve(InputReader in, PrintWriter out) {
            n = in.nextInt();
            S = new int[n];
            for (int i = 0; i < n; i++) {
                S[i] = in.nextInt();
            }
            q = in.nextInt();
            T = new int[q];
            for (int i = 0; i < q; i++) {
                T[i] = in.nextInt();
            }

            int ans = 0;
            for (int i = 0; i < q; i++) {
                if (binarySearch(S, T[i])) {
                    ans++;
                }
            }
            out.println(ans);
        }

        void debug(Object... os) {
            System.err.println(Arrays.deepToString(os));
        }
    }

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Solver solver = new Solver();
        solver.solve(in, out);
        out.close();
    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }
    }
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.*;
import java.awt.Point;

public class Main {
    // static int INF = (1 << 30) - 1;
    // static long L_INF = (1L << 62) - 1;
    // static long MOD = (long) 1e9 + 7;

    static class Solver {
        int n;
        int[] S;
        int q;
        int[] T;

        boolean binarySearch(int[] arr, int v) {
            int left = 0;
            int right = arr.length;
            while (left < right) {
                int mid = (left + right) / 2;
                if (arr[mid] == v) {
                    return true;
                } else if (arr[mid] < v) {
                    left = mid + 1;
                } else {
                    right = mid;
                }
            }
            return false;
        }

        // write your code
        void solve(InputReader in, PrintWriter out) {
            n = in.nextInt();
            S = new int[n];
            for (int i = 0; i < n; i++) {
                S[i] = in.nextInt();
            }
            q = in.nextInt();
            T = new int[q];
            for (int i = 0; i < q; i++) {
                T[i] = in.nextInt();
            }

            int ans = 0;
            for (int i = 0; i < q; i++) {
                if (binarySearch(S, T[i])) {
                    ans++;
                }
            }
            out.println(ans);
        }

        void debug(Object... os) {
            System.err.println(Arrays.deepToString(os));
        }
    }

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Solver solver = new Solver();
        solver.solve(in, out);
        out.close();
    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }
    }
}

