import java.util.Scanner;

public class Main {
    int n, k;
    long[] as;
    long[] qs;
    public static void main(String[] args) {
        Main p = new Main();
        p.read();
        p.solve();
    }

    void read() {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        as = new long[n];
        for (int i = 0; i < n; i++) {
            as[i] = sc.nextLong();
        }
        k = sc.nextInt();
        qs = new long[k];
        for (int i = 0; i < k; i++) {
            qs[i] = sc.nextLong();
        }
    }

    void solve() {
        long ans = 0;
        for (long query: qs) {
            int l = 0;
            int r = n;
            while (l != r) {
                int mid = l + (r - l) / 2;
                if (as[mid] == query) {
                    ans++;
                    break;
                }
                if (as[mid] > query) {
                    r = mid;
                } else {
                    l = mid + 1;
                }
            }
        }
        System.out.println(ans);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    int n, k;
    long[] as;
    long[] qs;
    public static void main(String[] args) {
        Main p = new Main();
        p.read();
        p.solve();
    }

    void read() {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        as = new long[n];
        for (int i = 0; i < n; i++) {
            as[i] = sc.nextLong();
        }
        k = sc.nextInt();
        qs = new long[k];
        for (int i = 0; i < k; i++) {
            qs[i] = sc.nextLong();
        }
    }

    void solve() {
        long ans = 0;
        for (long query: qs) {
            int l = 0;
            int r = n;
            while (l != r) {
                int mid = l + (r - l) / 2;
                if (as[mid] == query) {
                    ans++;
                    break;
                }
                if (as[mid] > query) {
                    r = mid;
                } else {
                    l = mid + 1;
                }
            }
        }
        System.out.println(ans);
    }
} Main int n n k; k long[] as; as long[] qs; qs public static void main(String[] args) {
        Main p = new Main();
        p.read();
        p.solve();
    } main {
        Main p = new Main();
        p.read();
        p.solve();
    } Main p = new Main(); p new Main() p.read() p.read p p.solve() p.solve p String[] args args void read() {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        as = new long[n];
        for (int i = 0; i < n; i++) {
            as[i] = sc.nextLong();
        }
        k = sc.nextInt();
        qs = new long[k];
        for (int i = 0; i < k; i++) {
            qs[i] = sc.nextLong();
        }
    } read {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        as = new long[n];
        for (int i = 0; i < n; i++) {
            as[i] = sc.nextLong();
        }
        k = sc.nextInt();
        qs = new long[k];
        for (int i = 0; i < k; i++) {
            qs[i] = sc.nextLong();
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) n = sc.nextInt() n sc.nextInt() sc.nextInt sc as = new long[n] as new long[n] n for (int i = 0; i < n; i++) {
            as[i] = sc.nextLong();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            as[i] = sc.nextLong();
        } {
            as[i] = sc.nextLong();
        } as[i] = sc.nextLong() as[i] as i sc.nextLong() sc.nextLong sc k = sc.nextInt() k sc.nextInt() sc.nextInt sc qs = new long[k] qs new long[k] k for (int i = 0; i < k; i++) {
            qs[i] = sc.nextLong();
        } int i = 0; int i = 0; i 0 i < k i k i++ i++ i {
            qs[i] = sc.nextLong();
        } {
            qs[i] = sc.nextLong();
        } qs[i] = sc.nextLong() qs[i] qs i sc.nextLong() sc.nextLong sc void solve() {
        long ans = 0;
        for (long query: qs) {
            int l = 0;
            int r = n;
            while (l != r) {
                int mid = l + (r - l) / 2;
                if (as[mid] == query) {
                    ans++;
                    break;
                }
                if (as[mid] > query) {
                    r = mid;
                } else {
                    l = mid + 1;
                }
            }
        }
        System.out.println(ans);
    } solve {
        long ans = 0;
        for (long query: qs) {
            int l = 0;
            int r = n;
            while (l != r) {
                int mid = l + (r - l) / 2;
                if (as[mid] == query) {
                    ans++;
                    break;
                }
                if (as[mid] > query) {
                    r = mid;
                } else {
                    l = mid + 1;
                }
            }
        }
        System.out.println(ans);
    } long ans = 0; ans 0 for (long query: qs) {
            int l = 0;
            int r = n;
            while (l != r) {
                int mid = l + (r - l) / 2;
                if (as[mid] == query) {
                    ans++;
                    break;
                }
                if (as[mid] > query) {
                    r = mid;
                } else {
                    l = mid + 1;
                }
            }
        } long query qs {
            int l = 0;
            int r = n;
            while (l != r) {
                int mid = l + (r - l) / 2;
                if (as[mid] == query) {
                    ans++;
                    break;
                }
                if (as[mid] > query) {
                    r = mid;
                } else {
                    l = mid + 1;
                }
            }
        } {
            int l = 0;
            int r = n;
            while (l != r) {
                int mid = l + (r - l) / 2;
                if (as[mid] == query) {
                    ans++;
                    break;
                }
                if (as[mid] > query) {
                    r = mid;
                } else {
                    l = mid + 1;
                }
            }
        } int l = 0; l 0 int r = n; r n while (l != r) {
                int mid = l + (r - l) / 2;
                if (as[mid] == query) {
                    ans++;
                    break;
                }
                if (as[mid] > query) {
                    r = mid;
                } else {
                    l = mid + 1;
                }
            } l != r l r {
                int mid = l + (r - l) / 2;
                if (as[mid] == query) {
                    ans++;
                    break;
                }
                if (as[mid] > query) {
                    r = mid;
                } else {
                    l = mid + 1;
                }
            } int mid = l + (r - l) / 2; mid l + (r - l) / 2 l (r - l) / 2 (r - l) r l 2 if (as[mid] == query) {
                    ans++;
                    break;
                } as[mid] == query as[mid] as mid query {
                    ans++;
                    break;
                } ans++ ans break; if (as[mid] > query) {
                    r = mid;
                } else {
                    l = mid + 1;
                } as[mid] > query as[mid] as mid query {
                    r = mid;
                } r = mid r mid {
                    l = mid + 1;
                } l = mid + 1 l mid + 1 mid 1 System.out.println(ans) System.out.println System.out System System.out ans public class Main {
    int n, k;
    long[] as;
    long[] qs;
    public static void main(String[] args) {
        Main p = new Main();
        p.read();
        p.solve();
    }

    void read() {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        as = new long[n];
        for (int i = 0; i < n; i++) {
            as[i] = sc.nextLong();
        }
        k = sc.nextInt();
        qs = new long[k];
        for (int i = 0; i < k; i++) {
            qs[i] = sc.nextLong();
        }
    }

    void solve() {
        long ans = 0;
        for (long query: qs) {
            int l = 0;
            int r = n;
            while (l != r) {
                int mid = l + (r - l) / 2;
                if (as[mid] == query) {
                    ans++;
                    break;
                }
                if (as[mid] > query) {
                    r = mid;
                } else {
                    l = mid + 1;
                }
            }
        }
        System.out.println(ans);
    }
} public class Main {
    int n, k;
    long[] as;
    long[] qs;
    public static void main(String[] args) {
        Main p = new Main();
        p.read();
        p.solve();
    }

    void read() {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        as = new long[n];
        for (int i = 0; i < n; i++) {
            as[i] = sc.nextLong();
        }
        k = sc.nextInt();
        qs = new long[k];
        for (int i = 0; i < k; i++) {
            qs[i] = sc.nextLong();
        }
    }

    void solve() {
        long ans = 0;
        for (long query: qs) {
            int l = 0;
            int r = n;
            while (l != r) {
                int mid = l + (r - l) / 2;
                if (as[mid] == query) {
                    ans++;
                    break;
                }
                if (as[mid] > query) {
                    r = mid;
                } else {
                    l = mid + 1;
                }
            }
        }
        System.out.println(ans);
    }
} Main
import java.util.Scanner;

public class Main {
    int n, k;
    long[] as;
    long[] qs;
    public static void main(String[] args) {
        Main p = new Main();
        p.read();
        p.solve();
    }

    void read() {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        as = new long[n];
        for (int i = 0; i < n; i++) {
            as[i] = sc.nextLong();
        }
        k = sc.nextInt();
        qs = new long[k];
        for (int i = 0; i < k; i++) {
            qs[i] = sc.nextLong();
        }
    }

    void solve() {
        long ans = 0;
        for (long query: qs) {
            int l = 0;
            int r = n;
            while (l != r) {
                int mid = l + (r - l) / 2;
                if (as[mid] == query) {
                    ans++;
                    break;
                }
                if (as[mid] > query) {
                    r = mid;
                } else {
                    l = mid + 1;
                }
            }
        }
        System.out.println(ans);
    }
}