import java.util.Scanner;

public class Main{
    public static int binarySearch(int start, int n, int[] S, int q) {
        int mid = (start + n) / 2;
        if(mid == start || mid == n)return -1;
        if (S[n] < q || S[start] > q)
        return -1;
        if (S[start] == q){
            return 1;
        }
        if(S[mid] == q ){
            return 1;
        }
        if(S[n] == q) {
            return 1;
        }
        if (S[mid] < q) {
            return binarySearch(mid, n, S, q);
        } else {
            return binarySearch(start, mid, S, q);
        }
    }
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n, q;
        int S[];
        int T[];
        n = scan.nextInt();
        S = new int[n];
        for (int i = 0; i < n; i++) {
            S[i] = scan.nextInt();
        }
        q = scan.nextInt();
        T = new int[q];
        for (int i = 0; i < q; i++) {
            T[i] = scan.nextInt();
        }
        scan.close();
        for (int i = 0; i < q; i++) {
            for (int j = i+1; j < q; j++) {
                if(T[i] == T[j])T[j]=-1;
            }
        }

        int ans = 0;

        for (int i = 0; i < q; i++) { 
            if (binarySearch(0, n-1, S, T[i]) == 1)ans++;
        }

        System.out.println(ans);
    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static int binarySearch(int start, int n, int[] S, int q) {
        int mid = (start + n) / 2;
        if(mid == start || mid == n)return -1;
        if (S[n] < q || S[start] > q)
        return -1;
        if (S[start] == q){
            return 1;
        }
        if(S[mid] == q ){
            return 1;
        }
        if(S[n] == q) {
            return 1;
        }
        if (S[mid] < q) {
            return binarySearch(mid, n, S, q);
        } else {
            return binarySearch(start, mid, S, q);
        }
    }
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n, q;
        int S[];
        int T[];
        n = scan.nextInt();
        S = new int[n];
        for (int i = 0; i < n; i++) {
            S[i] = scan.nextInt();
        }
        q = scan.nextInt();
        T = new int[q];
        for (int i = 0; i < q; i++) {
            T[i] = scan.nextInt();
        }
        scan.close();
        for (int i = 0; i < q; i++) {
            for (int j = i+1; j < q; j++) {
                if(T[i] == T[j])T[j]=-1;
            }
        }

        int ans = 0;

        for (int i = 0; i < q; i++) { 
            if (binarySearch(0, n-1, S, T[i]) == 1)ans++;
        }

        System.out.println(ans);
    }
} Main public static int binarySearch(int start, int n, int[] S, int q) {
        int mid = (start + n) / 2;
        if(mid == start || mid == n)return -1;
        if (S[n] < q || S[start] > q)
        return -1;
        if (S[start] == q){
            return 1;
        }
        if(S[mid] == q ){
            return 1;
        }
        if(S[n] == q) {
            return 1;
        }
        if (S[mid] < q) {
            return binarySearch(mid, n, S, q);
        } else {
            return binarySearch(start, mid, S, q);
        }
    } binarySearch {
        int mid = (start + n) / 2;
        if(mid == start || mid == n)return -1;
        if (S[n] < q || S[start] > q)
        return -1;
        if (S[start] == q){
            return 1;
        }
        if(S[mid] == q ){
            return 1;
        }
        if(S[n] == q) {
            return 1;
        }
        if (S[mid] < q) {
            return binarySearch(mid, n, S, q);
        } else {
            return binarySearch(start, mid, S, q);
        }
    } int mid = (start + n) / 2; mid (start + n) / 2 (start + n) start n 2 if(mid == start || mid == n)return -1; mid == start || mid == n mid == start mid start mid == n mid n return -1; -1 1 if (S[n] < q || S[start] > q)
        return -1; S[n] < q || S[start] > q S[n] < q S[n] S n q S[start] > q S[start] S start q return -1; -1 1 if (S[start] == q){
            return 1;
        } S[start] == q S[start] S start q {
            return 1;
        } return 1; 1 if(S[mid] == q ){
            return 1;
        } S[mid] == q S[mid] S mid q {
            return 1;
        } return 1; 1 if(S[n] == q) {
            return 1;
        } S[n] == q S[n] S n q {
            return 1;
        } return 1; 1 if (S[mid] < q) {
            return binarySearch(mid, n, S, q);
        } else {
            return binarySearch(start, mid, S, q);
        } S[mid] < q S[mid] S mid q {
            return binarySearch(mid, n, S, q);
        } return binarySearch(mid, n, S, q); binarySearch(mid, n, S, q) binarySearch mid n S q {
            return binarySearch(start, mid, S, q);
        } return binarySearch(start, mid, S, q); binarySearch(start, mid, S, q) binarySearch start mid S q int start start int n n int[] S S int q q public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n, q;
        int S[];
        int T[];
        n = scan.nextInt();
        S = new int[n];
        for (int i = 0; i < n; i++) {
            S[i] = scan.nextInt();
        }
        q = scan.nextInt();
        T = new int[q];
        for (int i = 0; i < q; i++) {
            T[i] = scan.nextInt();
        }
        scan.close();
        for (int i = 0; i < q; i++) {
            for (int j = i+1; j < q; j++) {
                if(T[i] == T[j])T[j]=-1;
            }
        }

        int ans = 0;

        for (int i = 0; i < q; i++) { 
            if (binarySearch(0, n-1, S, T[i]) == 1)ans++;
        }

        System.out.println(ans);
    } main {
        Scanner scan = new Scanner(System.in);
        int n, q;
        int S[];
        int T[];
        n = scan.nextInt();
        S = new int[n];
        for (int i = 0; i < n; i++) {
            S[i] = scan.nextInt();
        }
        q = scan.nextInt();
        T = new int[q];
        for (int i = 0; i < q; i++) {
            T[i] = scan.nextInt();
        }
        scan.close();
        for (int i = 0; i < q; i++) {
            for (int j = i+1; j < q; j++) {
                if(T[i] == T[j])T[j]=-1;
            }
        }

        int ans = 0;

        for (int i = 0; i < q; i++) { 
            if (binarySearch(0, n-1, S, T[i]) == 1)ans++;
        }

        System.out.println(ans);
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n n q; q int S[]; S int T[]; T n = scan.nextInt() n scan.nextInt() scan.nextInt scan S = new int[n] S new int[n] n for (int i = 0; i < n; i++) {
            S[i] = scan.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            S[i] = scan.nextInt();
        } {
            S[i] = scan.nextInt();
        } S[i] = scan.nextInt() S[i] S i scan.nextInt() scan.nextInt scan q = scan.nextInt() q scan.nextInt() scan.nextInt scan T = new int[q] T new int[q] q for (int i = 0; i < q; i++) {
            T[i] = scan.nextInt();
        } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
            T[i] = scan.nextInt();
        } {
            T[i] = scan.nextInt();
        } T[i] = scan.nextInt() T[i] T i scan.nextInt() scan.nextInt scan scan.close() scan.close scan for (int i = 0; i < q; i++) {
            for (int j = i+1; j < q; j++) {
                if(T[i] == T[j])T[j]=-1;
            }
        } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
            for (int j = i+1; j < q; j++) {
                if(T[i] == T[j])T[j]=-1;
            }
        } {
            for (int j = i+1; j < q; j++) {
                if(T[i] == T[j])T[j]=-1;
            }
        } for (int j = i+1; j < q; j++) {
                if(T[i] == T[j])T[j]=-1;
            } int j = i+1; int j = i+1; j i+1 i 1 j < q j q j++ j++ j {
                if(T[i] == T[j])T[j]=-1;
            } {
                if(T[i] == T[j])T[j]=-1;
            } if(T[i] == T[j])T[j]=-1; T[i] == T[j] T[i] T i T[j] T j T[j]=-1 T[j] T j -1 1 int ans = 0; ans 0 for (int i = 0; i < q; i++) { 
            if (binarySearch(0, n-1, S, T[i]) == 1)ans++;
        } int i = 0; int i = 0; i 0 i < q i q i++ i++ i { 
            if (binarySearch(0, n-1, S, T[i]) == 1)ans++;
        } { 
            if (binarySearch(0, n-1, S, T[i]) == 1)ans++;
        } if (binarySearch(0, n-1, S, T[i]) == 1)ans++; binarySearch(0, n-1, S, T[i]) == 1 binarySearch(0, n-1, S, T[i]) binarySearch 0 n-1 n 1 S T[i] T i 1 ans++ ans System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main{
    public static int binarySearch(int start, int n, int[] S, int q) {
        int mid = (start + n) / 2;
        if(mid == start || mid == n)return -1;
        if (S[n] < q || S[start] > q)
        return -1;
        if (S[start] == q){
            return 1;
        }
        if(S[mid] == q ){
            return 1;
        }
        if(S[n] == q) {
            return 1;
        }
        if (S[mid] < q) {
            return binarySearch(mid, n, S, q);
        } else {
            return binarySearch(start, mid, S, q);
        }
    }
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n, q;
        int S[];
        int T[];
        n = scan.nextInt();
        S = new int[n];
        for (int i = 0; i < n; i++) {
            S[i] = scan.nextInt();
        }
        q = scan.nextInt();
        T = new int[q];
        for (int i = 0; i < q; i++) {
            T[i] = scan.nextInt();
        }
        scan.close();
        for (int i = 0; i < q; i++) {
            for (int j = i+1; j < q; j++) {
                if(T[i] == T[j])T[j]=-1;
            }
        }

        int ans = 0;

        for (int i = 0; i < q; i++) { 
            if (binarySearch(0, n-1, S, T[i]) == 1)ans++;
        }

        System.out.println(ans);
    }
} public class Main{
    public static int binarySearch(int start, int n, int[] S, int q) {
        int mid = (start + n) / 2;
        if(mid == start || mid == n)return -1;
        if (S[n] < q || S[start] > q)
        return -1;
        if (S[start] == q){
            return 1;
        }
        if(S[mid] == q ){
            return 1;
        }
        if(S[n] == q) {
            return 1;
        }
        if (S[mid] < q) {
            return binarySearch(mid, n, S, q);
        } else {
            return binarySearch(start, mid, S, q);
        }
    }
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n, q;
        int S[];
        int T[];
        n = scan.nextInt();
        S = new int[n];
        for (int i = 0; i < n; i++) {
            S[i] = scan.nextInt();
        }
        q = scan.nextInt();
        T = new int[q];
        for (int i = 0; i < q; i++) {
            T[i] = scan.nextInt();
        }
        scan.close();
        for (int i = 0; i < q; i++) {
            for (int j = i+1; j < q; j++) {
                if(T[i] == T[j])T[j]=-1;
            }
        }

        int ans = 0;

        for (int i = 0; i < q; i++) { 
            if (binarySearch(0, n-1, S, T[i]) == 1)ans++;
        }

        System.out.println(ans);
    }
} Main
import java.util.Scanner;

public class Main{
    public static int binarySearch(int start, int n, int[] S, int q) {
        int mid = (start + n) / 2;
        if(mid == start || mid == n)return -1;
        if (S[n] < q || S[start] > q)
        return -1;
        if (S[start] == q){
            return 1;
        }
        if(S[mid] == q ){
            return 1;
        }
        if(S[n] == q) {
            return 1;
        }
        if (S[mid] < q) {
            return binarySearch(mid, n, S, q);
        } else {
            return binarySearch(start, mid, S, q);
        }
    }
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n, q;
        int S[];
        int T[];
        n = scan.nextInt();
        S = new int[n];
        for (int i = 0; i < n; i++) {
            S[i] = scan.nextInt();
        }
        q = scan.nextInt();
        T = new int[q];
        for (int i = 0; i < q; i++) {
            T[i] = scan.nextInt();
        }
        scan.close();
        for (int i = 0; i < q; i++) {
            for (int j = i+1; j < q; j++) {
                if(T[i] == T[j])T[j]=-1;
            }
        }

        int ans = 0;

        for (int i = 0; i < q; i++) { 
            if (binarySearch(0, n-1, S, T[i]) == 1)ans++;
        }

        System.out.println(ans);
    }
}
