import java.util.Scanner;

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

        int c = 0;
        for (int i : t) {
            if (binarySearch(s, i)) {
                c++;
            }
        }
        System.out.println(c);
    }

    private static boolean binarySearch(int[] s, int val) {
        int left = 0;
        int right = s.length - 1;
        int mid = (right + left) / 2;

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

        int c = 0;
        for (int i : t) {
            if (binarySearch(s, i)) {
                c++;
            }
        }
        System.out.println(c);
    }

    private static boolean binarySearch(int[] s, int val) {
        int left = 0;
        int right = s.length - 1;
        int mid = (right + left) / 2;

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

        int c = 0;
        for (int i : t) {
            if (binarySearch(s, i)) {
                c++;
            }
        }
        System.out.println(c);
    } main {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] s = new int[n];
        for (int i = 0; i < n; i++) {
            s[i] = in.nextInt();
        }
        int q = in.nextInt();
        int[] t = new int[q];
        for (int i = 0; i < q; i++) {
            t[i] = in.nextInt();
        }

        int c = 0;
        for (int i : t) {
            if (binarySearch(s, i)) {
                c++;
            }
        }
        System.out.println(c);
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) int n = in.nextInt(); n in.nextInt() in.nextInt in int[] s = new int[n]; s new int[n] n for (int i = 0; i < n; i++) {
            s[i] = in.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            s[i] = in.nextInt();
        } {
            s[i] = in.nextInt();
        } s[i] = in.nextInt() s[i] s i in.nextInt() in.nextInt in int q = in.nextInt(); q in.nextInt() in.nextInt in int[] t = new int[q]; t new int[q] q for (int i = 0; i < q; i++) {
            t[i] = in.nextInt();
        } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
            t[i] = in.nextInt();
        } {
            t[i] = in.nextInt();
        } t[i] = in.nextInt() t[i] t i in.nextInt() in.nextInt in int c = 0; c 0 for (int i : t) {
            if (binarySearch(s, i)) {
                c++;
            }
        } int i t {
            if (binarySearch(s, i)) {
                c++;
            }
        } {
            if (binarySearch(s, i)) {
                c++;
            }
        } if (binarySearch(s, i)) {
                c++;
            } binarySearch(s, i) binarySearch s i {
                c++;
            } c++ c System.out.println(c) System.out.println System.out System System.out c String[] args args private static boolean binarySearch(int[] s, int val) {
        int left = 0;
        int right = s.length - 1;
        int mid = (right + left) / 2;

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

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

        int c = 0;
        for (int i : t) {
            if (binarySearch(s, i)) {
                c++;
            }
        }
        System.out.println(c);
    }

    private static boolean binarySearch(int[] s, int val) {
        int left = 0;
        int right = s.length - 1;
        int mid = (right + left) / 2;

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

        int c = 0;
        for (int i : t) {
            if (binarySearch(s, i)) {
                c++;
            }
        }
        System.out.println(c);
    }

    private static boolean binarySearch(int[] s, int val) {
        int left = 0;
        int right = s.length - 1;
        int mid = (right + left) / 2;

        while (left <= right) {
            if (s[mid] == val) {
                return true;
            } else if (s[mid] > val) {
                right = mid - 1;
                mid = (right + left) / 2;
            } else {
                left = mid + 1;
                mid = (right + left) / 2;
            }
        }
        return false;
    }
} Main
import java.util.Scanner;

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

        int c = 0;
        for (int i : t) {
            if (binarySearch(s, i)) {
                c++;
            }
        }
        System.out.println(c);
    }

    private static boolean binarySearch(int[] s, int val) {
        int left = 0;
        int right = s.length - 1;
        int mid = (right + left) / 2;

        while (left <= right) {
            if (s[mid] == val) {
                return true;
            } else if (s[mid] > val) {
                right = mid - 1;
                mid = (right + left) / 2;
            } else {
                left = mid + 1;
                mid = (right + left) / 2;
            }
        }
        return false;
    }
}

