import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] S = new int[n];
        for(int i = 0; i < n; i++) S[i] = Integer.parseInt(sc.next());
        int q = sc.nextInt();
        int ans = 0;
        label:
        for(int i = 0; i < q; i++) {
            int t = Integer.parseInt(sc.next());
            int l = 0;
            int u = n-1;
            while(l <= u) {
                int m = (l + u) / 2;
                if(S[m] == t) {
                    ans++;
                    continue label;
                }
                if(S[m] < t) l = m+1;
                else u = m-1;
            }
        }
        System.out.println(ans);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] S = new int[n];
        for(int i = 0; i < n; i++) S[i] = Integer.parseInt(sc.next());
        int q = sc.nextInt();
        int ans = 0;
        label:
        for(int i = 0; i < q; i++) {
            int t = Integer.parseInt(sc.next());
            int l = 0;
            int u = n-1;
            while(l <= u) {
                int m = (l + u) / 2;
                if(S[m] == t) {
                    ans++;
                    continue label;
                }
                if(S[m] < t) l = m+1;
                else u = m-1;
            }
        }
        System.out.println(ans);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] S = new int[n];
        for(int i = 0; i < n; i++) S[i] = Integer.parseInt(sc.next());
        int q = sc.nextInt();
        int ans = 0;
        label:
        for(int i = 0; i < q; i++) {
            int t = Integer.parseInt(sc.next());
            int l = 0;
            int u = n-1;
            while(l <= u) {
                int m = (l + u) / 2;
                if(S[m] == t) {
                    ans++;
                    continue label;
                }
                if(S[m] < t) l = m+1;
                else u = m-1;
            }
        }
        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] S = new int[n];
        for(int i = 0; i < n; i++) S[i] = Integer.parseInt(sc.next());
        int q = sc.nextInt();
        int ans = 0;
        label:
        for(int i = 0; i < q; i++) {
            int t = Integer.parseInt(sc.next());
            int l = 0;
            int u = n-1;
            while(l <= u) {
                int m = (l + u) / 2;
                if(S[m] == t) {
                    ans++;
                    continue label;
                }
                if(S[m] < t) l = m+1;
                else u = m-1;
            }
        }
        System.out.println(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] S = new int[n]; S new int[n] n for(int i = 0; i < n; i++) S[i] = Integer.parseInt(sc.next()); int i = 0; int i = 0; i 0 i < n i n i++ i++ i S[i] = Integer.parseInt(sc.next()); S[i] = Integer.parseInt(sc.next()) S[i] S i Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int q = sc.nextInt(); q sc.nextInt() sc.nextInt sc int ans = 0; ans 0 System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] S = new int[n];
        for(int i = 0; i < n; i++) S[i] = Integer.parseInt(sc.next());
        int q = sc.nextInt();
        int ans = 0;
        label:
        for(int i = 0; i < q; i++) {
            int t = Integer.parseInt(sc.next());
            int l = 0;
            int u = n-1;
            while(l <= u) {
                int m = (l + u) / 2;
                if(S[m] == t) {
                    ans++;
                    continue label;
                }
                if(S[m] < t) l = m+1;
                else u = m-1;
            }
        }
        System.out.println(ans);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] S = new int[n];
        for(int i = 0; i < n; i++) S[i] = Integer.parseInt(sc.next());
        int q = sc.nextInt();
        int ans = 0;
        label:
        for(int i = 0; i < q; i++) {
            int t = Integer.parseInt(sc.next());
            int l = 0;
            int u = n-1;
            while(l <= u) {
                int m = (l + u) / 2;
                if(S[m] == t) {
                    ans++;
                    continue label;
                }
                if(S[m] < t) l = m+1;
                else u = m-1;
            }
        }
        System.out.println(ans);
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] S = new int[n];
        for(int i = 0; i < n; i++) S[i] = Integer.parseInt(sc.next());
        int q = sc.nextInt();
        int ans = 0;
        label:
        for(int i = 0; i < q; i++) {
            int t = Integer.parseInt(sc.next());
            int l = 0;
            int u = n-1;
            while(l <= u) {
                int m = (l + u) / 2;
                if(S[m] == t) {
                    ans++;
                    continue label;
                }
                if(S[m] < t) l = m+1;
                else u = m-1;
            }
        }
        System.out.println(ans);
    }
}
