import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        int n = sc.nextInt();
        int[] S = new int[n];
        for(int i=0; i<n; i++)  S[i] = sc.nextInt();
        int q = sc.nextInt();
        int[] T = new int[q];
        for(int i=0; i<q; i++) T[i] = sc.nextInt();
        int ans = 0;
        for(int key:T){
            if(binarySearch(S, key)) ans++;
        }
        System.out.println(ans);

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

        }
        return false;
    }


    static class FastScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

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

        public String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }

            return tokenizer.nextToken("\n");
        }

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

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

    }
}
 import java.io.*; io.* java import java.util.*; util.* java public class Main {

    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        int n = sc.nextInt();
        int[] S = new int[n];
        for(int i=0; i<n; i++)  S[i] = sc.nextInt();
        int q = sc.nextInt();
        int[] T = new int[q];
        for(int i=0; i<q; i++) T[i] = sc.nextInt();
        int ans = 0;
        for(int key:T){
            if(binarySearch(S, key)) ans++;
        }
        System.out.println(ans);

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

        }
        return false;
    }


    static class FastScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

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

        public String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }

            return tokenizer.nextToken("\n");
        }

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

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

    }
} Main public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        int n = sc.nextInt();
        int[] S = new int[n];
        for(int i=0; i<n; i++)  S[i] = sc.nextInt();
        int q = sc.nextInt();
        int[] T = new int[q];
        for(int i=0; i<q; i++) T[i] = sc.nextInt();
        int ans = 0;
        for(int key:T){
            if(binarySearch(S, key)) ans++;
        }
        System.out.println(ans);

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

    } FastScanner sc = new FastScanner(System.in); sc new FastScanner(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] = sc.nextInt(); int i=0; int i=0; i 0 i<n i n i++ i++ i S[i] = sc.nextInt(); S[i] = sc.nextInt() S[i] S i sc.nextInt() sc.nextInt sc int q = sc.nextInt(); q sc.nextInt() sc.nextInt sc int[] T = new int[q]; T new int[q] q for(int i=0; i<q; i++) T[i] = sc.nextInt(); int i=0; int i=0; i 0 i<q i q i++ i++ i T[i] = sc.nextInt(); T[i] = sc.nextInt() T[i] T i sc.nextInt() sc.nextInt sc int ans = 0; ans 0 for(int key:T){
            if(binarySearch(S, key)) ans++;
        } int key T {
            if(binarySearch(S, key)) ans++;
        } {
            if(binarySearch(S, key)) ans++;
        } if(binarySearch(S, key)) ans++; binarySearch(S, key) binarySearch S key ans++ ans System.out.println(ans) System.out.println System.out System System.out ans String[] args args public static boolean binarySearch(int[] A, int key){
        int left = 0;
        int right = A.length;
        while(left < right){
            int mid = (left + right) /2;
            if(A[mid] == key){
                return true;
            }else if(key < A[mid]){
                right = mid;
            }else{
                left = mid + 1;
            }

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

        }
        return false;
    } int left = 0; left 0 int right = A.length; right A.length A A.length while(left < right){
            int mid = (left + right) /2;
            if(A[mid] == key){
                return true;
            }else if(key < A[mid]){
                right = mid;
            }else{
                left = mid + 1;
            }

        } left < right left right {
            int mid = (left + right) /2;
            if(A[mid] == key){
                return true;
            }else if(key < A[mid]){
                right = mid;
            }else{
                left = mid + 1;
            }

        } int mid = (left + right) /2; mid (left + right) /2 (left + right) left right 2 if(A[mid] == key){
                return true;
            }else if(key < A[mid]){
                right = mid;
            }else{
                left = mid + 1;
            } A[mid] == key A[mid] A mid key {
                return true;
            } return true; true if(key < A[mid]){
                right = mid;
            }else{
                left = mid + 1;
            } key < A[mid] key A[mid] A mid {
                right = mid;
            } right = mid right mid {
                left = mid + 1;
            } left = mid + 1 left mid + 1 mid 1 return false; false int[] A A int key key static class FastScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

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

        public String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }

            return tokenizer.nextToken("\n");
        }

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

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

    } FastScanner private BufferedReader reader = null; reader null private StringTokenizer tokenizer = null; tokenizer null public FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        } FastScanner {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        } reader = new BufferedReader(new InputStreamReader(in)) reader new BufferedReader(new InputStreamReader(in)) tokenizer = null tokenizer null InputStream in in public String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        } next {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        } if (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 public String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }

            return tokenizer.nextToken("\n");
        } nextLine {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }

            return tokenizer.nextToken("\n");
        } if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return 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 {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            } try {
                    return 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) {
                    return reader.readLine();
                } return reader.readLine(); reader.readLine() reader.readLine reader return tokenizer.nextToken("\n"); tokenizer.nextToken("\n") tokenizer.nextToken tokenizer "\n" public long nextLong() {
            return Long.parseLong(next());
        } nextLong {
            return Long.parseLong(next());
        } return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next public int nextInt() {
            return Integer.parseInt(next());
        } nextInt {
            return Integer.parseInt(next());
        } return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next public class Main {

    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        int n = sc.nextInt();
        int[] S = new int[n];
        for(int i=0; i<n; i++)  S[i] = sc.nextInt();
        int q = sc.nextInt();
        int[] T = new int[q];
        for(int i=0; i<q; i++) T[i] = sc.nextInt();
        int ans = 0;
        for(int key:T){
            if(binarySearch(S, key)) ans++;
        }
        System.out.println(ans);

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

        }
        return false;
    }


    static class FastScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

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

        public String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }

            return tokenizer.nextToken("\n");
        }

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

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

    }
} public class Main {

    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        int n = sc.nextInt();
        int[] S = new int[n];
        for(int i=0; i<n; i++)  S[i] = sc.nextInt();
        int q = sc.nextInt();
        int[] T = new int[q];
        for(int i=0; i<q; i++) T[i] = sc.nextInt();
        int ans = 0;
        for(int key:T){
            if(binarySearch(S, key)) ans++;
        }
        System.out.println(ans);

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

        }
        return false;
    }


    static class FastScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

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

        public String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }

            return tokenizer.nextToken("\n");
        }

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

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

    }
} Main
import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        int n = sc.nextInt();
        int[] S = new int[n];
        for(int i=0; i<n; i++)  S[i] = sc.nextInt();
        int q = sc.nextInt();
        int[] T = new int[q];
        for(int i=0; i<q; i++) T[i] = sc.nextInt();
        int ans = 0;
        for(int key:T){
            if(binarySearch(S, key)) ans++;
        }
        System.out.println(ans);

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

        }
        return false;
    }


    static class FastScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

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

        public String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }

            return tokenizer.nextToken("\n");
        }

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

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

    }
}

