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[] t = new int[n];
        for (int i = 0; i < q; i++) {
            t[i] = sc.nextInt();
        }
        int c = 0;
        for (int i = 0; i < q; i++) {
            // if (Arrays.binarySearch(s, t[i]) >= 0) {
            //     c++;
            // }
            int left = -1;
            int right = n;
            while (right - left > 1) {
                int mid = left + (right - left) / 2;
                if (s[mid] == t[i]) {
                    c++;
                    break;
                } else if (s[mid] > t[i]) {
                    right = mid;
                } else {
                    left = mid;
                }
            }
        }
        System.out.println(c);
    }
} 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[] t = new int[n];
        for (int i = 0; i < q; i++) {
            t[i] = sc.nextInt();
        }
        int c = 0;
        for (int i = 0; i < q; i++) {
            // if (Arrays.binarySearch(s, t[i]) >= 0) {
            //     c++;
            // }
            int left = -1;
            int right = n;
            while (right - left > 1) {
                int mid = left + (right - left) / 2;
                if (s[mid] == t[i]) {
                    c++;
                    break;
                } else if (s[mid] > t[i]) {
                    right = mid;
                } else {
                    left = mid;
                }
            }
        }
        System.out.println(c);
    }
} 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[] t = new int[n];
        for (int i = 0; i < q; i++) {
            t[i] = sc.nextInt();
        }
        int c = 0;
        for (int i = 0; i < q; i++) {
            // if (Arrays.binarySearch(s, t[i]) >= 0) {
            //     c++;
            // }
            int left = -1;
            int right = n;
            while (right - left > 1) {
                int mid = left + (right - left) / 2;
                if (s[mid] == t[i]) {
                    c++;
                    break;
                } else if (s[mid] > t[i]) {
                    right = mid;
                } else {
                    left = mid;
                }
            }
        }
        System.out.println(c);
    } 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[] t = new int[n];
        for (int i = 0; i < q; i++) {
            t[i] = sc.nextInt();
        }
        int c = 0;
        for (int i = 0; i < q; i++) {
            // if (Arrays.binarySearch(s, t[i]) >= 0) {
            //     c++;
            // }
            int left = -1;
            int right = n;
            while (right - left > 1) {
                int mid = left + (right - left) / 2;
                if (s[mid] == t[i]) {
                    c++;
                    break;
                } else if (s[mid] > t[i]) {
                    right = mid;
                } else {
                    left = mid;
                }
            }
        }
        System.out.println(c);
    } 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[] t = new int[n]; t new int[n] n for (int i = 0; i < q; i++) {
            t[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
            t[i] = sc.nextInt();
        } {
            t[i] = sc.nextInt();
        } t[i] = sc.nextInt() t[i] t i sc.nextInt() sc.nextInt sc int c = 0; c 0 for (int i = 0; i < q; i++) {
            // if (Arrays.binarySearch(s, t[i]) >= 0) {
            //     c++;
            // }
            int left = -1;
            int right = n;
            while (right - left > 1) {
                int mid = left + (right - left) / 2;
                if (s[mid] == t[i]) {
                    c++;
                    break;
                } else if (s[mid] > t[i]) {
                    right = mid;
                } else {
                    left = mid;
                }
            }
        } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
            // if (Arrays.binarySearch(s, t[i]) >= 0) {
            //     c++;
            // }
            int left = -1;
            int right = n;
            while (right - left > 1) {
                int mid = left + (right - left) / 2;
                if (s[mid] == t[i]) {
                    c++;
                    break;
                } else if (s[mid] > t[i]) {
                    right = mid;
                } else {
                    left = mid;
                }
            }
        } {
            // if (Arrays.binarySearch(s, t[i]) >= 0) {
            //     c++;
            // }
            int left = -1;
            int right = n;
            while (right - left > 1) {
                int mid = left + (right - left) / 2;
                if (s[mid] == t[i]) {
                    c++;
                    break;
                } else if (s[mid] > t[i]) {
                    right = mid;
                } else {
                    left = mid;
                }
            }
        } int left = -1; left -1 1 int right = n; right n while (right - left > 1) {
                int mid = left + (right - left) / 2;
                if (s[mid] == t[i]) {
                    c++;
                    break;
                } else if (s[mid] > t[i]) {
                    right = mid;
                } else {
                    left = mid;
                }
            } right - left > 1 right - left right left 1 {
                int mid = left + (right - left) / 2;
                if (s[mid] == t[i]) {
                    c++;
                    break;
                } else if (s[mid] > t[i]) {
                    right = mid;
                } else {
                    left = mid;
                }
            } int mid = left + (right - left) / 2; mid left + (right - left) / 2 left (right - left) / 2 (right - left) right left 2 if (s[mid] == t[i]) {
                    c++;
                    break;
                } else if (s[mid] > t[i]) {
                    right = mid;
                } else {
                    left = mid;
                } s[mid] == t[i] s[mid] s mid t[i] t i {
                    c++;
                    break;
                } c++ c break; if (s[mid] > t[i]) {
                    right = mid;
                } else {
                    left = mid;
                } s[mid] > t[i] s[mid] s mid t[i] t i {
                    right = mid;
                } right = mid right mid {
                    left = mid;
                } left = mid left mid System.out.println(c) System.out.println System.out System System.out c String[] args args 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[] t = new int[n];
        for (int i = 0; i < q; i++) {
            t[i] = sc.nextInt();
        }
        int c = 0;
        for (int i = 0; i < q; i++) {
            // if (Arrays.binarySearch(s, t[i]) >= 0) {
            //     c++;
            // }
            int left = -1;
            int right = n;
            while (right - left > 1) {
                int mid = left + (right - left) / 2;
                if (s[mid] == t[i]) {
                    c++;
                    break;
                } else if (s[mid] > t[i]) {
                    right = mid;
                } else {
                    left = mid;
                }
            }
        }
        System.out.println(c);
    }
} 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[] t = new int[n];
        for (int i = 0; i < q; i++) {
            t[i] = sc.nextInt();
        }
        int c = 0;
        for (int i = 0; i < q; i++) {
            // if (Arrays.binarySearch(s, t[i]) >= 0) {
            //     c++;
            // }
            int left = -1;
            int right = n;
            while (right - left > 1) {
                int mid = left + (right - left) / 2;
                if (s[mid] == t[i]) {
                    c++;
                    break;
                } else if (s[mid] > t[i]) {
                    right = mid;
                } else {
                    left = mid;
                }
            }
        }
        System.out.println(c);
    }
} 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[] t = new int[n];
        for (int i = 0; i < q; i++) {
            t[i] = sc.nextInt();
        }
        int c = 0;
        for (int i = 0; i < q; i++) {
            // if (Arrays.binarySearch(s, t[i]) >= 0) {
            //     c++;
            // }
            int left = -1;
            int right = n;
            while (right - left > 1) {
                int mid = left + (right - left) / 2;
                if (s[mid] == t[i]) {
                    c++;
                    break;
                } else if (s[mid] > t[i]) {
                    right = mid;
                } else {
                    left = mid;
                }
            }
        }
        System.out.println(c);
    }
}