import java.util.Arrays;
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++;
            }
        }
        System.out.println(c);
    }
} import java.util.Arrays; Arrays java.util 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++;
            }
        }
        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++;
            }
        }
        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++;
            }
        }
        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 i = 0; int i = 0; i 0 i < q i q i++ i++ i {
            if (Arrays.binarySearch(s, t[i]) >= 0) {
                c++;
            }
        } {
            if (Arrays.binarySearch(s, t[i]) >= 0) {
                c++;
            }
        } if (Arrays.binarySearch(s, t[i]) >= 0) {
                c++;
            } Arrays.binarySearch(s, t[i]) >= 0 Arrays.binarySearch(s, t[i]) Arrays.binarySearch Arrays s t[i] t i 0 {
                c++;
            } c++ c 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++;
            }
        }
        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++;
            }
        }
        System.out.println(c);
    }
} Main
import java.util.Arrays;
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++;
            }
        }
        System.out.println(c);
    }
}