import java.util.*;

class Main {

    public static boolean bsearch(ArrayList<Integer> a, int left, int right, int goal) {
        while (left <= right) {
            int mid = (left + right) / 2;
            if (a.get(mid) < goal) {
                left = mid + 1;
            } else if (a.get(mid) > goal) {
                right = mid - 1;
            } else {
                return true;
            }
        }
        return false;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        ArrayList<Integer> s = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            s.add(in.nextInt());
        }
        Collections.sort(s);
        n = in.nextInt();
        int res = 0;
        for (int i = 0; i < n; i++) {
            if (bsearch(s, 0, s.size() - 1, in.nextInt())) {
                res += 1;
            }
        }
        System.out.println(res);
    }
} import java.util.*; util.* java class Main {

    public static boolean bsearch(ArrayList<Integer> a, int left, int right, int goal) {
        while (left <= right) {
            int mid = (left + right) / 2;
            if (a.get(mid) < goal) {
                left = mid + 1;
            } else if (a.get(mid) > goal) {
                right = mid - 1;
            } else {
                return true;
            }
        }
        return false;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        ArrayList<Integer> s = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            s.add(in.nextInt());
        }
        Collections.sort(s);
        n = in.nextInt();
        int res = 0;
        for (int i = 0; i < n; i++) {
            if (bsearch(s, 0, s.size() - 1, in.nextInt())) {
                res += 1;
            }
        }
        System.out.println(res);
    }
} Main public static boolean bsearch(ArrayList<Integer> a, int left, int right, int goal) {
        while (left <= right) {
            int mid = (left + right) / 2;
            if (a.get(mid) < goal) {
                left = mid + 1;
            } else if (a.get(mid) > goal) {
                right = mid - 1;
            } else {
                return true;
            }
        }
        return false;
    } bsearch {
        while (left <= right) {
            int mid = (left + right) / 2;
            if (a.get(mid) < goal) {
                left = mid + 1;
            } else if (a.get(mid) > goal) {
                right = mid - 1;
            } else {
                return true;
            }
        }
        return false;
    } while (left <= right) {
            int mid = (left + right) / 2;
            if (a.get(mid) < goal) {
                left = mid + 1;
            } else if (a.get(mid) > goal) {
                right = mid - 1;
            } else {
                return true;
            }
        } left <= right left right {
            int mid = (left + right) / 2;
            if (a.get(mid) < goal) {
                left = mid + 1;
            } else if (a.get(mid) > goal) {
                right = mid - 1;
            } else {
                return true;
            }
        } int mid = (left + right) / 2; mid (left + right) / 2 (left + right) left right 2 if (a.get(mid) < goal) {
                left = mid + 1;
            } else if (a.get(mid) > goal) {
                right = mid - 1;
            } else {
                return true;
            } a.get(mid) < goal a.get(mid) a.get a mid goal {
                left = mid + 1;
            } left = mid + 1 left mid + 1 mid 1 if (a.get(mid) > goal) {
                right = mid - 1;
            } else {
                return true;
            } a.get(mid) > goal a.get(mid) a.get a mid goal {
                right = mid - 1;
            } right = mid - 1 right mid - 1 mid 1 {
                return true;
            } return true; true return false; false ArrayList<Integer> a a int left left int right right int goal goal public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        ArrayList<Integer> s = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            s.add(in.nextInt());
        }
        Collections.sort(s);
        n = in.nextInt();
        int res = 0;
        for (int i = 0; i < n; i++) {
            if (bsearch(s, 0, s.size() - 1, in.nextInt())) {
                res += 1;
            }
        }
        System.out.println(res);
    } main {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        ArrayList<Integer> s = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            s.add(in.nextInt());
        }
        Collections.sort(s);
        n = in.nextInt();
        int res = 0;
        for (int i = 0; i < n; i++) {
            if (bsearch(s, 0, s.size() - 1, in.nextInt())) {
                res += 1;
            }
        }
        System.out.println(res);
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) int n = in.nextInt(); n in.nextInt() in.nextInt in ArrayList<Integer> s = new ArrayList<>(); s new ArrayList<>() 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 Collections.sort(s) Collections.sort Collections s n = in.nextInt() n in.nextInt() in.nextInt in int res = 0; res 0 for (int i = 0; i < n; i++) {
            if (bsearch(s, 0, s.size() - 1, in.nextInt())) {
                res += 1;
            }
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            if (bsearch(s, 0, s.size() - 1, in.nextInt())) {
                res += 1;
            }
        } {
            if (bsearch(s, 0, s.size() - 1, in.nextInt())) {
                res += 1;
            }
        } if (bsearch(s, 0, s.size() - 1, in.nextInt())) {
                res += 1;
            } bsearch(s, 0, s.size() - 1, in.nextInt()) bsearch s 0 s.size() - 1 s.size() s.size s 1 in.nextInt() in.nextInt in {
                res += 1;
            } res += 1 res 1 System.out.println(res) System.out.println System.out System System.out res String[] args args
import java.util.*;

class Main {

    public static boolean bsearch(ArrayList<Integer> a, int left, int right, int goal) {
        while (left <= right) {
            int mid = (left + right) / 2;
            if (a.get(mid) < goal) {
                left = mid + 1;
            } else if (a.get(mid) > goal) {
                right = mid - 1;
            } else {
                return true;
            }
        }
        return false;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        ArrayList<Integer> s = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            s.add(in.nextInt());
        }
        Collections.sort(s);
        n = in.nextInt();
        int res = 0;
        for (int i = 0; i < n; i++) {
            if (bsearch(s, 0, s.size() - 1, in.nextInt())) {
                res += 1;
            }
        }
        System.out.println(res);
    }
}