
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int [] S = new int [n];
        for (int i = 0; i < n; i++) {
            S[i] = s.nextInt();
        }
        int q = s.nextInt();
        int [] T = new int [q];
        for (int i = 0; i < q; i++) {
            T[i] = s.nextInt();
        }

        int C  = 0;

        for (int i = 0; i < q; i++) {
            if (search(T[i], S)) {
                C++;
            }
        }
        System.out.println(C);
    }

    static boolean search(int a, int []S) {
        int left = 0;
        int right = S.length ;
        int middle;

        while (left < right) {
            middle = (left + right ) / 2;
            if (S[middle] == a) {
                return true;
            } else if (S[middle] < a) {
                left = middle + 1;
            } else {
                right = middle;
            }
        }
        return false;
    }
}
 import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int [] S = new int [n];
        for (int i = 0; i < n; i++) {
            S[i] = s.nextInt();
        }
        int q = s.nextInt();
        int [] T = new int [q];
        for (int i = 0; i < q; i++) {
            T[i] = s.nextInt();
        }

        int C  = 0;

        for (int i = 0; i < q; i++) {
            if (search(T[i], S)) {
                C++;
            }
        }
        System.out.println(C);
    }

    static boolean search(int a, int []S) {
        int left = 0;
        int right = S.length ;
        int middle;

        while (left < right) {
            middle = (left + right ) / 2;
            if (S[middle] == a) {
                return true;
            } else if (S[middle] < a) {
                left = middle + 1;
            } else {
                right = middle;
            }
        }
        return false;
    }
} Main public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int [] S = new int [n];
        for (int i = 0; i < n; i++) {
            S[i] = s.nextInt();
        }
        int q = s.nextInt();
        int [] T = new int [q];
        for (int i = 0; i < q; i++) {
            T[i] = s.nextInt();
        }

        int C  = 0;

        for (int i = 0; i < q; i++) {
            if (search(T[i], S)) {
                C++;
            }
        }
        System.out.println(C);
    } main {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int [] S = new int [n];
        for (int i = 0; i < n; i++) {
            S[i] = s.nextInt();
        }
        int q = s.nextInt();
        int [] T = new int [q];
        for (int i = 0; i < q; i++) {
            T[i] = s.nextInt();
        }

        int C  = 0;

        for (int i = 0; i < q; i++) {
            if (search(T[i], S)) {
                C++;
            }
        }
        System.out.println(C);
    } Scanner s = new Scanner(System.in); s new Scanner(System.in) int n = s.nextInt(); n s.nextInt() s.nextInt s int [] S = new int [n]; S new int [n] n for (int i = 0; i < n; i++) {
            S[i] = s.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            S[i] = s.nextInt();
        } {
            S[i] = s.nextInt();
        } S[i] = s.nextInt() S[i] S i s.nextInt() s.nextInt s int q = s.nextInt(); q s.nextInt() s.nextInt s int [] T = new int [q]; T new int [q] q for (int i = 0; i < q; i++) {
            T[i] = s.nextInt();
        } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
            T[i] = s.nextInt();
        } {
            T[i] = s.nextInt();
        } T[i] = s.nextInt() T[i] T i s.nextInt() s.nextInt s int C  = 0; C 0 for (int i = 0; i < q; i++) {
            if (search(T[i], S)) {
                C++;
            }
        } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
            if (search(T[i], S)) {
                C++;
            }
        } {
            if (search(T[i], S)) {
                C++;
            }
        } if (search(T[i], S)) {
                C++;
            } search(T[i], S) search T[i] T i S {
                C++;
            } C++ C System.out.println(C) System.out.println System.out System System.out C String[] args args static boolean search(int a, int []S) {
        int left = 0;
        int right = S.length ;
        int middle;

        while (left < right) {
            middle = (left + right ) / 2;
            if (S[middle] == a) {
                return true;
            } else if (S[middle] < a) {
                left = middle + 1;
            } else {
                right = middle;
            }
        }
        return false;
    } search {
        int left = 0;
        int right = S.length ;
        int middle;

        while (left < right) {
            middle = (left + right ) / 2;
            if (S[middle] == a) {
                return true;
            } else if (S[middle] < a) {
                left = middle + 1;
            } else {
                right = middle;
            }
        }
        return false;
    } int left = 0; left 0 int right = S.length ; right S.length S S.length int middle; middle while (left < right) {
            middle = (left + right ) / 2;
            if (S[middle] == a) {
                return true;
            } else if (S[middle] < a) {
                left = middle + 1;
            } else {
                right = middle;
            }
        } left < right left right {
            middle = (left + right ) / 2;
            if (S[middle] == a) {
                return true;
            } else if (S[middle] < a) {
                left = middle + 1;
            } else {
                right = middle;
            }
        } middle = (left + right ) / 2 middle (left + right ) / 2 (left + right ) left right 2 if (S[middle] == a) {
                return true;
            } else if (S[middle] < a) {
                left = middle + 1;
            } else {
                right = middle;
            } S[middle] == a S[middle] S middle a {
                return true;
            } return true; true if (S[middle] < a) {
                left = middle + 1;
            } else {
                right = middle;
            } S[middle] < a S[middle] S middle a {
                left = middle + 1;
            } left = middle + 1 left middle + 1 middle 1 {
                right = middle;
            } right = middle right middle return false; false int a a int []S S public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int [] S = new int [n];
        for (int i = 0; i < n; i++) {
            S[i] = s.nextInt();
        }
        int q = s.nextInt();
        int [] T = new int [q];
        for (int i = 0; i < q; i++) {
            T[i] = s.nextInt();
        }

        int C  = 0;

        for (int i = 0; i < q; i++) {
            if (search(T[i], S)) {
                C++;
            }
        }
        System.out.println(C);
    }

    static boolean search(int a, int []S) {
        int left = 0;
        int right = S.length ;
        int middle;

        while (left < right) {
            middle = (left + right ) / 2;
            if (S[middle] == a) {
                return true;
            } else if (S[middle] < a) {
                left = middle + 1;
            } else {
                right = middle;
            }
        }
        return false;
    }
} public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int [] S = new int [n];
        for (int i = 0; i < n; i++) {
            S[i] = s.nextInt();
        }
        int q = s.nextInt();
        int [] T = new int [q];
        for (int i = 0; i < q; i++) {
            T[i] = s.nextInt();
        }

        int C  = 0;

        for (int i = 0; i < q; i++) {
            if (search(T[i], S)) {
                C++;
            }
        }
        System.out.println(C);
    }

    static boolean search(int a, int []S) {
        int left = 0;
        int right = S.length ;
        int middle;

        while (left < right) {
            middle = (left + right ) / 2;
            if (S[middle] == a) {
                return true;
            } else if (S[middle] < a) {
                left = middle + 1;
            } else {
                right = middle;
            }
        }
        return false;
    }
} Main

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int [] S = new int [n];
        for (int i = 0; i < n; i++) {
            S[i] = s.nextInt();
        }
        int q = s.nextInt();
        int [] T = new int [q];
        for (int i = 0; i < q; i++) {
            T[i] = s.nextInt();
        }

        int C  = 0;

        for (int i = 0; i < q; i++) {
            if (search(T[i], S)) {
                C++;
            }
        }
        System.out.println(C);
    }

    static boolean search(int a, int []S) {
        int left = 0;
        int right = S.length ;
        int middle;

        while (left < right) {
            middle = (left + right ) / 2;
            if (S[middle] == a) {
                return true;
            } else if (S[middle] < a) {
                left = middle + 1;
            } else {
                right = middle;
            }
        }
        return false;
    }
}

