import java.util.Scanner;
import java.util.HashMap;
import java.util.Map;

public class Main{
    public static void main(final String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] a = new int[n];
        Map<Integer, Integer> mp = new HashMap<Integer, Integer>();
        for (int i = 0; i < n; i++) {
            a[i] = scan.nextInt();
            mp.put(a[i], 1);
        }
        int q = scan.nextInt();
        int ans = 0;
        while (q > 0) {
            final int s = scan.nextInt();
            if(mp.containsKey(s)) ans++;
            q--;
        }
        System.out.println(ans);
    }
} import java.util.Scanner; Scanner java.util import java.util.HashMap; HashMap java.util import java.util.Map; Map java.util public class Main{
    public static void main(final String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] a = new int[n];
        Map<Integer, Integer> mp = new HashMap<Integer, Integer>();
        for (int i = 0; i < n; i++) {
            a[i] = scan.nextInt();
            mp.put(a[i], 1);
        }
        int q = scan.nextInt();
        int ans = 0;
        while (q > 0) {
            final int s = scan.nextInt();
            if(mp.containsKey(s)) ans++;
            q--;
        }
        System.out.println(ans);
    }
} Main public static void main(final String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] a = new int[n];
        Map<Integer, Integer> mp = new HashMap<Integer, Integer>();
        for (int i = 0; i < n; i++) {
            a[i] = scan.nextInt();
            mp.put(a[i], 1);
        }
        int q = scan.nextInt();
        int ans = 0;
        while (q > 0) {
            final int s = scan.nextInt();
            if(mp.containsKey(s)) ans++;
            q--;
        }
        System.out.println(ans);
    } main {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] a = new int[n];
        Map<Integer, Integer> mp = new HashMap<Integer, Integer>();
        for (int i = 0; i < n; i++) {
            a[i] = scan.nextInt();
            mp.put(a[i], 1);
        }
        int q = scan.nextInt();
        int ans = 0;
        while (q > 0) {
            final int s = scan.nextInt();
            if(mp.containsKey(s)) ans++;
            q--;
        }
        System.out.println(ans);
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int[] a = new int[n]; a new int[n] n Map<Integer, Integer> mp = new HashMap<Integer, Integer>(); mp new HashMap<Integer, Integer>() for (int i = 0; i < n; i++) {
            a[i] = scan.nextInt();
            mp.put(a[i], 1);
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            a[i] = scan.nextInt();
            mp.put(a[i], 1);
        } {
            a[i] = scan.nextInt();
            mp.put(a[i], 1);
        } a[i] = scan.nextInt() a[i] a i scan.nextInt() scan.nextInt scan mp.put(a[i], 1) mp.put mp a[i] a i 1 int q = scan.nextInt(); q scan.nextInt() scan.nextInt scan int ans = 0; ans 0 while (q > 0) {
            final int s = scan.nextInt();
            if(mp.containsKey(s)) ans++;
            q--;
        } q > 0 q 0 {
            final int s = scan.nextInt();
            if(mp.containsKey(s)) ans++;
            q--;
        } final int s = scan.nextInt(); s scan.nextInt() scan.nextInt scan if(mp.containsKey(s)) ans++; mp.containsKey(s) mp.containsKey mp s ans++ ans q-- q System.out.println(ans) System.out.println System.out System System.out ans final String[] args args public class Main{
    public static void main(final String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] a = new int[n];
        Map<Integer, Integer> mp = new HashMap<Integer, Integer>();
        for (int i = 0; i < n; i++) {
            a[i] = scan.nextInt();
            mp.put(a[i], 1);
        }
        int q = scan.nextInt();
        int ans = 0;
        while (q > 0) {
            final int s = scan.nextInt();
            if(mp.containsKey(s)) ans++;
            q--;
        }
        System.out.println(ans);
    }
} public class Main{
    public static void main(final String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] a = new int[n];
        Map<Integer, Integer> mp = new HashMap<Integer, Integer>();
        for (int i = 0; i < n; i++) {
            a[i] = scan.nextInt();
            mp.put(a[i], 1);
        }
        int q = scan.nextInt();
        int ans = 0;
        while (q > 0) {
            final int s = scan.nextInt();
            if(mp.containsKey(s)) ans++;
            q--;
        }
        System.out.println(ans);
    }
} Main
import java.util.Scanner;
import java.util.HashMap;
import java.util.Map;

public class Main{
    public static void main(final String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] a = new int[n];
        Map<Integer, Integer> mp = new HashMap<Integer, Integer>();
        for (int i = 0; i < n; i++) {
            a[i] = scan.nextInt();
            mp.put(a[i], 1);
        }
        int q = scan.nextInt();
        int ans = 0;
        while (q > 0) {
            final int s = scan.nextInt();
            if(mp.containsKey(s)) ans++;
            q--;
        }
        System.out.println(ans);
    }
}
