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