import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author silviase
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        binarySearch solver = new binarySearch();
        solver.solve(1, in, out);
        out.close();
    }

    static class binarySearch {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = in.nextInt();
            int q = in.nextInt();
            int cnt = 0;
            for (int i = 0; i < q; i++) {
                int key = in.nextInt();
                int ng = -1;
                int ok = a.length;
                while (Math.abs(ok - ng) > 1) {
                    int mid = (ok + ng) / 2;
                    if (a[mid] >= key) {
                        ok = mid;
                    } else {
                        ng = mid;
                    }
                }
                if (a[ok] == key) cnt++;
            }
            out.println(cnt);
        }

    }
}

 import java.io.OutputStream; OutputStream java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.PrintWriter; PrintWriter java.io import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        binarySearch solver = new binarySearch();
        solver.solve(1, in, out);
        out.close();
    }

    static class binarySearch {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = in.nextInt();
            int q = in.nextInt();
            int cnt = 0;
            for (int i = 0; i < q; i++) {
                int key = in.nextInt();
                int ng = -1;
                int ok = a.length;
                while (Math.abs(ok - ng) > 1) {
                    int mid = (ok + ng) / 2;
                    if (a[mid] >= key) {
                        ok = mid;
                    } else {
                        ng = mid;
                    }
                }
                if (a[ok] == key) cnt++;
            }
            out.println(cnt);
        }

    }
} Main public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        binarySearch solver = new binarySearch();
        solver.solve(1, in, out);
        out.close();
    } main {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        binarySearch solver = new binarySearch();
        solver.solve(1, in, out);
        out.close();
    } InputStream inputStream = System.in; inputStream System.in System System.in OutputStream outputStream = System.out; outputStream System.out System System.out Scanner in = new Scanner(inputStream); in new Scanner(inputStream) PrintWriter out = new PrintWriter(outputStream); out new PrintWriter(outputStream) binarySearch solver = new binarySearch(); solver new binarySearch() solver.solve(1, in, out) solver.solve solver 1 in out out.close() out.close out String[] args args static class binarySearch {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = in.nextInt();
            int q = in.nextInt();
            int cnt = 0;
            for (int i = 0; i < q; i++) {
                int key = in.nextInt();
                int ng = -1;
                int ok = a.length;
                while (Math.abs(ok - ng) > 1) {
                    int mid = (ok + ng) / 2;
                    if (a[mid] >= key) {
                        ok = mid;
                    } else {
                        ng = mid;
                    }
                }
                if (a[ok] == key) cnt++;
            }
            out.println(cnt);
        }

    } binarySearch public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = in.nextInt();
            int q = in.nextInt();
            int cnt = 0;
            for (int i = 0; i < q; i++) {
                int key = in.nextInt();
                int ng = -1;
                int ok = a.length;
                while (Math.abs(ok - ng) > 1) {
                    int mid = (ok + ng) / 2;
                    if (a[mid] >= key) {
                        ok = mid;
                    } else {
                        ng = mid;
                    }
                }
                if (a[ok] == key) cnt++;
            }
            out.println(cnt);
        } solve {
            int n = in.nextInt();
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = in.nextInt();
            int q = in.nextInt();
            int cnt = 0;
            for (int i = 0; i < q; i++) {
                int key = in.nextInt();
                int ng = -1;
                int ok = a.length;
                while (Math.abs(ok - ng) > 1) {
                    int mid = (ok + ng) / 2;
                    if (a[mid] >= key) {
                        ok = mid;
                    } else {
                        ng = mid;
                    }
                }
                if (a[ok] == key) cnt++;
            }
            out.println(cnt);
        } int n = in.nextInt(); n in.nextInt() in.nextInt in int[] a = new int[n]; a new int[n] n for (int i = 0; i < n; i++) a[i] = in.nextInt(); int i = 0; int i = 0; i 0 i < n i n i++ i++ i a[i] = in.nextInt(); a[i] = in.nextInt() a[i] a i in.nextInt() in.nextInt in int q = in.nextInt(); q in.nextInt() in.nextInt in int cnt = 0; cnt 0 for (int i = 0; i < q; i++) {
                int key = in.nextInt();
                int ng = -1;
                int ok = a.length;
                while (Math.abs(ok - ng) > 1) {
                    int mid = (ok + ng) / 2;
                    if (a[mid] >= key) {
                        ok = mid;
                    } else {
                        ng = mid;
                    }
                }
                if (a[ok] == key) cnt++;
            } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
                int key = in.nextInt();
                int ng = -1;
                int ok = a.length;
                while (Math.abs(ok - ng) > 1) {
                    int mid = (ok + ng) / 2;
                    if (a[mid] >= key) {
                        ok = mid;
                    } else {
                        ng = mid;
                    }
                }
                if (a[ok] == key) cnt++;
            } {
                int key = in.nextInt();
                int ng = -1;
                int ok = a.length;
                while (Math.abs(ok - ng) > 1) {
                    int mid = (ok + ng) / 2;
                    if (a[mid] >= key) {
                        ok = mid;
                    } else {
                        ng = mid;
                    }
                }
                if (a[ok] == key) cnt++;
            } int key = in.nextInt(); key in.nextInt() in.nextInt in int ng = -1; ng -1 1 int ok = a.length; ok a.length a a.length while (Math.abs(ok - ng) > 1) {
                    int mid = (ok + ng) / 2;
                    if (a[mid] >= key) {
                        ok = mid;
                    } else {
                        ng = mid;
                    }
                } Math.abs(ok - ng) > 1 Math.abs(ok - ng) Math.abs Math ok - ng ok ng 1 {
                    int mid = (ok + ng) / 2;
                    if (a[mid] >= key) {
                        ok = mid;
                    } else {
                        ng = mid;
                    }
                } int mid = (ok + ng) / 2; mid (ok + ng) / 2 (ok + ng) ok ng 2 if (a[mid] >= key) {
                        ok = mid;
                    } else {
                        ng = mid;
                    } a[mid] >= key a[mid] a mid key {
                        ok = mid;
                    } ok = mid ok mid {
                        ng = mid;
                    } ng = mid ng mid if (a[ok] == key) cnt++; a[ok] == key a[ok] a ok key cnt++ cnt out.println(cnt) out.println out cnt int testNumber testNumber Scanner in in PrintWriter out out public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        binarySearch solver = new binarySearch();
        solver.solve(1, in, out);
        out.close();
    }

    static class binarySearch {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = in.nextInt();
            int q = in.nextInt();
            int cnt = 0;
            for (int i = 0; i < q; i++) {
                int key = in.nextInt();
                int ng = -1;
                int ok = a.length;
                while (Math.abs(ok - ng) > 1) {
                    int mid = (ok + ng) / 2;
                    if (a[mid] >= key) {
                        ok = mid;
                    } else {
                        ng = mid;
                    }
                }
                if (a[ok] == key) cnt++;
            }
            out.println(cnt);
        }

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

    static class binarySearch {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = in.nextInt();
            int q = in.nextInt();
            int cnt = 0;
            for (int i = 0; i < q; i++) {
                int key = in.nextInt();
                int ng = -1;
                int ok = a.length;
                while (Math.abs(ok - ng) > 1) {
                    int mid = (ok + ng) / 2;
                    if (a[mid] >= key) {
                        ok = mid;
                    } else {
                        ng = mid;
                    }
                }
                if (a[ok] == key) cnt++;
            }
            out.println(cnt);
        }

    }
} Main
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author silviase
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        binarySearch solver = new binarySearch();
        solver.solve(1, in, out);
        out.close();
    }

    static class binarySearch {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = in.nextInt();
            int q = in.nextInt();
            int cnt = 0;
            for (int i = 0; i < q; i++) {
                int key = in.nextInt();
                int ng = -1;
                int ok = a.length;
                while (Math.abs(ok - ng) > 1) {
                    int mid = (ok + ng) / 2;
                    if (a[mid] >= key) {
                        ok = mid;
                    } else {
                        ng = mid;
                    }
                }
                if (a[ok] == key) cnt++;
            }
            out.println(cnt);
        }

    }
}


