import java.util.Scanner;

public class Main {

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

        int number = 0;

        for (int i = 0; i < q; i++) {
            int min = 0;
            int sup = n;
            LOOP: while(true) {
                if (t[i] >= s[(min + sup) / 2]) {
                    min = (min + sup) / 2;
                } else {
                    sup = (min + sup) / 2;
                }
                if (sup - min <= 1) {
                    if (t[i] == s[min]) number++;
                    break LOOP;
                }
            }

        }

        System.out.println(number);
        scanner.close();
    }
}
 import java.util.Scanner; Scanner java.util public class Main {

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

        int number = 0;

        for (int i = 0; i < q; i++) {
            int min = 0;
            int sup = n;
            LOOP: while(true) {
                if (t[i] >= s[(min + sup) / 2]) {
                    min = (min + sup) / 2;
                } else {
                    sup = (min + sup) / 2;
                }
                if (sup - min <= 1) {
                    if (t[i] == s[min]) number++;
                    break LOOP;
                }
            }

        }

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

        int number = 0;

        for (int i = 0; i < q; i++) {
            int min = 0;
            int sup = n;
            LOOP: while(true) {
                if (t[i] >= s[(min + sup) / 2]) {
                    min = (min + sup) / 2;
                } else {
                    sup = (min + sup) / 2;
                }
                if (sup - min <= 1) {
                    if (t[i] == s[min]) number++;
                    break LOOP;
                }
            }

        }

        System.out.println(number);
        scanner.close();
    } main {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] s = new int[n];
        for (int i = 0; i < n; i++) {
            s[i] = scanner.nextInt();
        }
        int q = scanner.nextInt();
        int[] t = new int[q];
        for (int i = 0; i < q; i++) {
            t[i] = scanner.nextInt();
        }

        int number = 0;

        for (int i = 0; i < q; i++) {
            int min = 0;
            int sup = n;
            LOOP: while(true) {
                if (t[i] >= s[(min + sup) / 2]) {
                    min = (min + sup) / 2;
                } else {
                    sup = (min + sup) / 2;
                }
                if (sup - min <= 1) {
                    if (t[i] == s[min]) number++;
                    break LOOP;
                }
            }

        }

        System.out.println(number);
        scanner.close();
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int n = scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner int[] s = new int[n]; s new int[n] n for (int i = 0; i < n; i++) {
            s[i] = scanner.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            s[i] = scanner.nextInt();
        } {
            s[i] = scanner.nextInt();
        } s[i] = scanner.nextInt() s[i] s i scanner.nextInt() scanner.nextInt scanner int q = scanner.nextInt(); q scanner.nextInt() scanner.nextInt scanner int[] t = new int[q]; t new int[q] q for (int i = 0; i < q; i++) {
            t[i] = scanner.nextInt();
        } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
            t[i] = scanner.nextInt();
        } {
            t[i] = scanner.nextInt();
        } t[i] = scanner.nextInt() t[i] t i scanner.nextInt() scanner.nextInt scanner int number = 0; number 0 for (int i = 0; i < q; i++) {
            int min = 0;
            int sup = n;
            LOOP: while(true) {
                if (t[i] >= s[(min + sup) / 2]) {
                    min = (min + sup) / 2;
                } else {
                    sup = (min + sup) / 2;
                }
                if (sup - min <= 1) {
                    if (t[i] == s[min]) number++;
                    break LOOP;
                }
            }

        } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
            int min = 0;
            int sup = n;
            LOOP: while(true) {
                if (t[i] >= s[(min + sup) / 2]) {
                    min = (min + sup) / 2;
                } else {
                    sup = (min + sup) / 2;
                }
                if (sup - min <= 1) {
                    if (t[i] == s[min]) number++;
                    break LOOP;
                }
            }

        } {
            int min = 0;
            int sup = n;
            LOOP: while(true) {
                if (t[i] >= s[(min + sup) / 2]) {
                    min = (min + sup) / 2;
                } else {
                    sup = (min + sup) / 2;
                }
                if (sup - min <= 1) {
                    if (t[i] == s[min]) number++;
                    break LOOP;
                }
            }

        } int min = 0; min 0 int sup = n; sup n System.out.println(number) System.out.println System.out System System.out number scanner.close() scanner.close scanner String[] args args public class Main {

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

        int number = 0;

        for (int i = 0; i < q; i++) {
            int min = 0;
            int sup = n;
            LOOP: while(true) {
                if (t[i] >= s[(min + sup) / 2]) {
                    min = (min + sup) / 2;
                } else {
                    sup = (min + sup) / 2;
                }
                if (sup - min <= 1) {
                    if (t[i] == s[min]) number++;
                    break LOOP;
                }
            }

        }

        System.out.println(number);
        scanner.close();
    }
} public class Main {

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

        int number = 0;

        for (int i = 0; i < q; i++) {
            int min = 0;
            int sup = n;
            LOOP: while(true) {
                if (t[i] >= s[(min + sup) / 2]) {
                    min = (min + sup) / 2;
                } else {
                    sup = (min + sup) / 2;
                }
                if (sup - min <= 1) {
                    if (t[i] == s[min]) number++;
                    break LOOP;
                }
            }

        }

        System.out.println(number);
        scanner.close();
    }
} Main
import java.util.Scanner;

public class Main {

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

        int number = 0;

        for (int i = 0; i < q; i++) {
            int min = 0;
            int sup = n;
            LOOP: while(true) {
                if (t[i] >= s[(min + sup) / 2]) {
                    min = (min + sup) / 2;
                } else {
                    sup = (min + sup) / 2;
                }
                if (sup - min <= 1) {
                    if (t[i] == s[min]) number++;
                    break LOOP;
                }
            }

        }

        System.out.println(number);
        scanner.close();
    }
}

