import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        Set<Integer> s = new HashSet<>(), t = new HashSet<>();
        for (int i = 0; i < n; i++) {
            s.add(in.nextInt());
        }
        n = in.nextInt();
        for (int i = 0; i < n; i++) {
            t.add(in.nextInt());
        }
        s.retainAll(t);
        System.out.println(s.size());
    }
} import java.util.*; util.* java class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        Set<Integer> s = new HashSet<>(), t = new HashSet<>();
        for (int i = 0; i < n; i++) {
            s.add(in.nextInt());
        }
        n = in.nextInt();
        for (int i = 0; i < n; i++) {
            t.add(in.nextInt());
        }
        s.retainAll(t);
        System.out.println(s.size());
    }
} Main public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        Set<Integer> s = new HashSet<>(), t = new HashSet<>();
        for (int i = 0; i < n; i++) {
            s.add(in.nextInt());
        }
        n = in.nextInt();
        for (int i = 0; i < n; i++) {
            t.add(in.nextInt());
        }
        s.retainAll(t);
        System.out.println(s.size());
    } main {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        Set<Integer> s = new HashSet<>(), t = new HashSet<>();
        for (int i = 0; i < n; i++) {
            s.add(in.nextInt());
        }
        n = in.nextInt();
        for (int i = 0; i < n; i++) {
            t.add(in.nextInt());
        }
        s.retainAll(t);
        System.out.println(s.size());
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) int n = in.nextInt(); n in.nextInt() in.nextInt in Set<Integer> s = new HashSet<>() s new HashSet<>() t = new HashSet<>(); t new HashSet<>() for (int i = 0; i < n; i++) {
            s.add(in.nextInt());
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            s.add(in.nextInt());
        } {
            s.add(in.nextInt());
        } s.add(in.nextInt()) s.add s in.nextInt() in.nextInt in n = in.nextInt() n in.nextInt() in.nextInt in for (int i = 0; i < n; i++) {
            t.add(in.nextInt());
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            t.add(in.nextInt());
        } {
            t.add(in.nextInt());
        } t.add(in.nextInt()) t.add t in.nextInt() in.nextInt in s.retainAll(t) s.retainAll s t System.out.println(s.size()) System.out.println System.out System System.out s.size() s.size s String[] args args
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        Set<Integer> s = new HashSet<>(), t = new HashSet<>();
        for (int i = 0; i < n; i++) {
            s.add(in.nextInt());
        }
        n = in.nextInt();
        for (int i = 0; i < n; i++) {
            t.add(in.nextInt());
        }
        s.retainAll(t);
        System.out.println(s.size());
    }
}