import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class Main {

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    void solve() throws IOException {
        int n = ni();
        int[] s = nia(n);
        int q = ni();
        int[] t = nia(q);

        int ans = 0;
        for (int i = 0; i < q; i++) {
            int high = n;
            int low = -1;
            while (high - low > 1) {
                int mid = (high + low) / 2;
                if (s[mid] > t[i]) {
                    high = mid;
                } else {
                    low = mid;
                }
            }
            if (low != -1 && s[low] == t[i]) ans++;
        }

        out.println(ans);
    }

    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }

    int ni() throws IOException {
        return Integer.parseInt(ns());
    }

    long nl() throws IOException {
        return Long.parseLong(ns());
    }

    double nd() throws IOException {
        return Double.parseDouble(ns());
    }

    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }

    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }

    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }

    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.PrintWriter; PrintWriter java.io import java.util.*; util.* java public class Main {

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    void solve() throws IOException {
        int n = ni();
        int[] s = nia(n);
        int q = ni();
        int[] t = nia(q);

        int ans = 0;
        for (int i = 0; i < q; i++) {
            int high = n;
            int low = -1;
            while (high - low > 1) {
                int mid = (high + low) / 2;
                if (s[mid] > t[i]) {
                    high = mid;
                } else {
                    low = mid;
                }
            }
            if (low != -1 && s[low] == t[i]) ans++;
        }

        out.println(ans);
    }

    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }

    int ni() throws IOException {
        return Integer.parseInt(ns());
    }

    long nl() throws IOException {
        return Long.parseLong(ns());
    }

    double nd() throws IOException {
        return Double.parseDouble(ns());
    }

    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }

    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }

    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }

    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
} Main static BufferedReader in; in static PrintWriter out; out static StringTokenizer tok; tok void solve() throws IOException {
        int n = ni();
        int[] s = nia(n);
        int q = ni();
        int[] t = nia(q);

        int ans = 0;
        for (int i = 0; i < q; i++) {
            int high = n;
            int low = -1;
            while (high - low > 1) {
                int mid = (high + low) / 2;
                if (s[mid] > t[i]) {
                    high = mid;
                } else {
                    low = mid;
                }
            }
            if (low != -1 && s[low] == t[i]) ans++;
        }

        out.println(ans);
    } solve {
        int n = ni();
        int[] s = nia(n);
        int q = ni();
        int[] t = nia(q);

        int ans = 0;
        for (int i = 0; i < q; i++) {
            int high = n;
            int low = -1;
            while (high - low > 1) {
                int mid = (high + low) / 2;
                if (s[mid] > t[i]) {
                    high = mid;
                } else {
                    low = mid;
                }
            }
            if (low != -1 && s[low] == t[i]) ans++;
        }

        out.println(ans);
    } int n = ni(); n ni() ni int[] s = nia(n); s nia(n) nia n int q = ni(); q ni() ni int[] t = nia(q); t nia(q) nia q int ans = 0; ans 0 for (int i = 0; i < q; i++) {
            int high = n;
            int low = -1;
            while (high - low > 1) {
                int mid = (high + low) / 2;
                if (s[mid] > t[i]) {
                    high = mid;
                } else {
                    low = mid;
                }
            }
            if (low != -1 && s[low] == t[i]) ans++;
        } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
            int high = n;
            int low = -1;
            while (high - low > 1) {
                int mid = (high + low) / 2;
                if (s[mid] > t[i]) {
                    high = mid;
                } else {
                    low = mid;
                }
            }
            if (low != -1 && s[low] == t[i]) ans++;
        } {
            int high = n;
            int low = -1;
            while (high - low > 1) {
                int mid = (high + low) / 2;
                if (s[mid] > t[i]) {
                    high = mid;
                } else {
                    low = mid;
                }
            }
            if (low != -1 && s[low] == t[i]) ans++;
        } int high = n; high n int low = -1; low -1 1 while (high - low > 1) {
                int mid = (high + low) / 2;
                if (s[mid] > t[i]) {
                    high = mid;
                } else {
                    low = mid;
                }
            } high - low > 1 high - low high low 1 {
                int mid = (high + low) / 2;
                if (s[mid] > t[i]) {
                    high = mid;
                } else {
                    low = mid;
                }
            } int mid = (high + low) / 2; mid (high + low) / 2 (high + low) high low 2 if (s[mid] > t[i]) {
                    high = mid;
                } else {
                    low = mid;
                } s[mid] > t[i] s[mid] s mid t[i] t i {
                    high = mid;
                } high = mid high mid {
                    low = mid;
                } low = mid low mid if (low != -1 && s[low] == t[i]) ans++; low != -1 && s[low] == t[i] low != -1 low -1 1 s[low] == t[i] s[low] s low t[i] t i ans++ ans out.println(ans) out.println out ans String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    } ns {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    } while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        } !tok.hasMoreTokens() tok.hasMoreTokens() tok.hasMoreTokens tok {
            tok = new StringTokenizer(in.readLine(), " ");
        } tok = new StringTokenizer(in.readLine(), " ") tok new StringTokenizer(in.readLine(), " ") return tok.nextToken(); tok.nextToken() tok.nextToken tok int ni() throws IOException {
        return Integer.parseInt(ns());
    } ni {
        return Integer.parseInt(ns());
    } return Integer.parseInt(ns()); Integer.parseInt(ns()) Integer.parseInt Integer ns() ns long nl() throws IOException {
        return Long.parseLong(ns());
    } nl {
        return Long.parseLong(ns());
    } return Long.parseLong(ns()); Long.parseLong(ns()) Long.parseLong Long ns() ns double nd() throws IOException {
        return Double.parseDouble(ns());
    } nd {
        return Double.parseDouble(ns());
    } return Double.parseDouble(ns()); Double.parseDouble(ns()) Double.parseDouble Double ns() ns String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    } nsa {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    } String[] res = new String[n]; res new String[n] n for (int i = 0; i < n; i++) {
            res[i] = ns();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            res[i] = ns();
        } {
            res[i] = ns();
        } res[i] = ns() res[i] res i ns() ns return res; res int n n int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    } nia {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    } int[] res = new int[n]; res new int[n] n for (int i = 0; i < n; i++) {
            res[i] = ni();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            res[i] = ni();
        } {
            res[i] = ni();
        } res[i] = ni() res[i] res i ni() ni return res; res int n n long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    } nla {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    } long[] res = new long[n]; res new long[n] n for (int i = 0; i < n; i++) {
            res[i] = nl();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            res[i] = nl();
        } {
            res[i] = nl();
        } res[i] = nl() res[i] res i nl() nl return res; res int n n public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    } main {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    } in = new BufferedReader(new InputStreamReader(System.in)) in new BufferedReader(new InputStreamReader(System.in)) out = new PrintWriter(System.out) out new PrintWriter(System.out) tok = new StringTokenizer("") tok new StringTokenizer("") Main main = new Main(); main new Main() main.solve() main.solve main out.close() out.close out String[] args args public class Main {

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    void solve() throws IOException {
        int n = ni();
        int[] s = nia(n);
        int q = ni();
        int[] t = nia(q);

        int ans = 0;
        for (int i = 0; i < q; i++) {
            int high = n;
            int low = -1;
            while (high - low > 1) {
                int mid = (high + low) / 2;
                if (s[mid] > t[i]) {
                    high = mid;
                } else {
                    low = mid;
                }
            }
            if (low != -1 && s[low] == t[i]) ans++;
        }

        out.println(ans);
    }

    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }

    int ni() throws IOException {
        return Integer.parseInt(ns());
    }

    long nl() throws IOException {
        return Long.parseLong(ns());
    }

    double nd() throws IOException {
        return Double.parseDouble(ns());
    }

    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }

    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }

    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }

    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
} public class Main {

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    void solve() throws IOException {
        int n = ni();
        int[] s = nia(n);
        int q = ni();
        int[] t = nia(q);

        int ans = 0;
        for (int i = 0; i < q; i++) {
            int high = n;
            int low = -1;
            while (high - low > 1) {
                int mid = (high + low) / 2;
                if (s[mid] > t[i]) {
                    high = mid;
                } else {
                    low = mid;
                }
            }
            if (low != -1 && s[low] == t[i]) ans++;
        }

        out.println(ans);
    }

    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }

    int ni() throws IOException {
        return Integer.parseInt(ns());
    }

    long nl() throws IOException {
        return Long.parseLong(ns());
    }

    double nd() throws IOException {
        return Double.parseDouble(ns());
    }

    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }

    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }

    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }

    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class Main {

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    void solve() throws IOException {
        int n = ni();
        int[] s = nia(n);
        int q = ni();
        int[] t = nia(q);

        int ans = 0;
        for (int i = 0; i < q; i++) {
            int high = n;
            int low = -1;
            while (high - low > 1) {
                int mid = (high + low) / 2;
                if (s[mid] > t[i]) {
                    high = mid;
                } else {
                    low = mid;
                }
            }
            if (low != -1 && s[low] == t[i]) ans++;
        }

        out.println(ans);
    }

    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }

    int ni() throws IOException {
        return Integer.parseInt(ns());
    }

    long nl() throws IOException {
        return Long.parseLong(ns());
    }

    double nd() throws IOException {
        return Double.parseDouble(ns());
    }

    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }

    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }

    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }

    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}