
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = Integer.parseInt(scan.next());
        int[] s = new int[n];
        for (int i = 0; i < n; i++) {
            s[i] = Integer.parseInt(scan.next());
        }
        int q = Integer.parseInt(scan.next());
        int[] t = new int[q];
        for (int i = 0; i < q; i++) {
            t[i] = Integer.parseInt(scan.next());
        }
        scan.close();

        int ans = 0;
        for (int i = 0; i < q; i++) {
            ans += binarySearch(s, t[i]);
        }
        System.out.println(ans);
    }

    private static int binarySearch(int[] s, int t) {
        int left = -1;
        int right = s.length;

        while (right - left > 1) {
            int mid = (right + left) / 2;
            if (s[mid] >= t) {
                right = mid;
            } else {
                left = mid;
            }
        }

        if (right == s.length) {
            return 0;
        }

        if (s[right] == t) {
            return 1;
        } else {
            return 0;
        }
    }
}
 import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = Integer.parseInt(scan.next());
        int[] s = new int[n];
        for (int i = 0; i < n; i++) {
            s[i] = Integer.parseInt(scan.next());
        }
        int q = Integer.parseInt(scan.next());
        int[] t = new int[q];
        for (int i = 0; i < q; i++) {
            t[i] = Integer.parseInt(scan.next());
        }
        scan.close();

        int ans = 0;
        for (int i = 0; i < q; i++) {
            ans += binarySearch(s, t[i]);
        }
        System.out.println(ans);
    }

    private static int binarySearch(int[] s, int t) {
        int left = -1;
        int right = s.length;

        while (right - left > 1) {
            int mid = (right + left) / 2;
            if (s[mid] >= t) {
                right = mid;
            } else {
                left = mid;
            }
        }

        if (right == s.length) {
            return 0;
        }

        if (s[right] == t) {
            return 1;
        } else {
            return 0;
        }
    }
} Main public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = Integer.parseInt(scan.next());
        int[] s = new int[n];
        for (int i = 0; i < n; i++) {
            s[i] = Integer.parseInt(scan.next());
        }
        int q = Integer.parseInt(scan.next());
        int[] t = new int[q];
        for (int i = 0; i < q; i++) {
            t[i] = Integer.parseInt(scan.next());
        }
        scan.close();

        int ans = 0;
        for (int i = 0; i < q; i++) {
            ans += binarySearch(s, t[i]);
        }
        System.out.println(ans);
    } main {
        Scanner scan = new Scanner(System.in);
        int n = Integer.parseInt(scan.next());
        int[] s = new int[n];
        for (int i = 0; i < n; i++) {
            s[i] = Integer.parseInt(scan.next());
        }
        int q = Integer.parseInt(scan.next());
        int[] t = new int[q];
        for (int i = 0; i < q; i++) {
            t[i] = Integer.parseInt(scan.next());
        }
        scan.close();

        int ans = 0;
        for (int i = 0; i < q; i++) {
            ans += binarySearch(s, t[i]);
        }
        System.out.println(ans);
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = Integer.parseInt(scan.next()); n Integer.parseInt(scan.next()) Integer.parseInt Integer scan.next() scan.next scan int[] s = new int[n]; s new int[n] n for (int i = 0; i < n; i++) {
            s[i] = Integer.parseInt(scan.next());
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            s[i] = Integer.parseInt(scan.next());
        } {
            s[i] = Integer.parseInt(scan.next());
        } s[i] = Integer.parseInt(scan.next()) s[i] s i Integer.parseInt(scan.next()) Integer.parseInt Integer scan.next() scan.next scan int q = Integer.parseInt(scan.next()); q Integer.parseInt(scan.next()) Integer.parseInt Integer scan.next() scan.next scan int[] t = new int[q]; t new int[q] q for (int i = 0; i < q; i++) {
            t[i] = Integer.parseInt(scan.next());
        } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
            t[i] = Integer.parseInt(scan.next());
        } {
            t[i] = Integer.parseInt(scan.next());
        } t[i] = Integer.parseInt(scan.next()) t[i] t i Integer.parseInt(scan.next()) Integer.parseInt Integer scan.next() scan.next scan scan.close() scan.close scan int ans = 0; ans 0 for (int i = 0; i < q; i++) {
            ans += binarySearch(s, t[i]);
        } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
            ans += binarySearch(s, t[i]);
        } {
            ans += binarySearch(s, t[i]);
        } ans += binarySearch(s, t[i]) ans binarySearch(s, t[i]) binarySearch s t[i] t i System.out.println(ans) System.out.println System.out System System.out ans String[] args args private static int binarySearch(int[] s, int t) {
        int left = -1;
        int right = s.length;

        while (right - left > 1) {
            int mid = (right + left) / 2;
            if (s[mid] >= t) {
                right = mid;
            } else {
                left = mid;
            }
        }

        if (right == s.length) {
            return 0;
        }

        if (s[right] == t) {
            return 1;
        } else {
            return 0;
        }
    } binarySearch {
        int left = -1;
        int right = s.length;

        while (right - left > 1) {
            int mid = (right + left) / 2;
            if (s[mid] >= t) {
                right = mid;
            } else {
                left = mid;
            }
        }

        if (right == s.length) {
            return 0;
        }

        if (s[right] == t) {
            return 1;
        } else {
            return 0;
        }
    } int left = -1; left -1 1 int right = s.length; right s.length s s.length while (right - left > 1) {
            int mid = (right + left) / 2;
            if (s[mid] >= t) {
                right = mid;
            } else {
                left = mid;
            }
        } right - left > 1 right - left right left 1 {
            int mid = (right + left) / 2;
            if (s[mid] >= t) {
                right = mid;
            } else {
                left = mid;
            }
        } int mid = (right + left) / 2; mid (right + left) / 2 (right + left) right left 2 if (s[mid] >= t) {
                right = mid;
            } else {
                left = mid;
            } s[mid] >= t s[mid] s mid t {
                right = mid;
            } right = mid right mid {
                left = mid;
            } left = mid left mid if (right == s.length) {
            return 0;
        } right == s.length right s.length s s.length {
            return 0;
        } return 0; 0 if (s[right] == t) {
            return 1;
        } else {
            return 0;
        } s[right] == t s[right] s right t {
            return 1;
        } return 1; 1 {
            return 0;
        } return 0; 0 int[] s s int t t public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = Integer.parseInt(scan.next());
        int[] s = new int[n];
        for (int i = 0; i < n; i++) {
            s[i] = Integer.parseInt(scan.next());
        }
        int q = Integer.parseInt(scan.next());
        int[] t = new int[q];
        for (int i = 0; i < q; i++) {
            t[i] = Integer.parseInt(scan.next());
        }
        scan.close();

        int ans = 0;
        for (int i = 0; i < q; i++) {
            ans += binarySearch(s, t[i]);
        }
        System.out.println(ans);
    }

    private static int binarySearch(int[] s, int t) {
        int left = -1;
        int right = s.length;

        while (right - left > 1) {
            int mid = (right + left) / 2;
            if (s[mid] >= t) {
                right = mid;
            } else {
                left = mid;
            }
        }

        if (right == s.length) {
            return 0;
        }

        if (s[right] == t) {
            return 1;
        } else {
            return 0;
        }
    }
} public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = Integer.parseInt(scan.next());
        int[] s = new int[n];
        for (int i = 0; i < n; i++) {
            s[i] = Integer.parseInt(scan.next());
        }
        int q = Integer.parseInt(scan.next());
        int[] t = new int[q];
        for (int i = 0; i < q; i++) {
            t[i] = Integer.parseInt(scan.next());
        }
        scan.close();

        int ans = 0;
        for (int i = 0; i < q; i++) {
            ans += binarySearch(s, t[i]);
        }
        System.out.println(ans);
    }

    private static int binarySearch(int[] s, int t) {
        int left = -1;
        int right = s.length;

        while (right - left > 1) {
            int mid = (right + left) / 2;
            if (s[mid] >= t) {
                right = mid;
            } else {
                left = mid;
            }
        }

        if (right == s.length) {
            return 0;
        }

        if (s[right] == t) {
            return 1;
        } else {
            return 0;
        }
    }
} Main

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = Integer.parseInt(scan.next());
        int[] s = new int[n];
        for (int i = 0; i < n; i++) {
            s[i] = Integer.parseInt(scan.next());
        }
        int q = Integer.parseInt(scan.next());
        int[] t = new int[q];
        for (int i = 0; i < q; i++) {
            t[i] = Integer.parseInt(scan.next());
        }
        scan.close();

        int ans = 0;
        for (int i = 0; i < q; i++) {
            ans += binarySearch(s, t[i]);
        }
        System.out.println(ans);
    }

    private static int binarySearch(int[] s, int t) {
        int left = -1;
        int right = s.length;

        while (right - left > 1) {
            int mid = (right + left) / 2;
            if (s[mid] >= t) {
                right = mid;
            } else {
                left = mid;
            }
        }

        if (right == s.length) {
            return 0;
        }

        if (s[right] == t) {
            return 1;
        } else {
            return 0;
        }
    }
}

