import 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[q];
        for (int i = 0; i < q; i++) {
            t[i] = sc.nextInt();
        }
        int ans = 0;
        for (int i = 0; i < q; i++) {
            int l = 0;
            int r = n;
            while(1 < r-l){
                int mid = (r + l) / 2;
                if(t[i] < s[mid]) r = mid;
                else l = mid;
            }
            if(s[l] == t[i]) ans++;
        }
        System.out.println(ans);
        sc.close();

    }

}
 import java.util.*; util.* java 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[q];
        for (int i = 0; i < q; i++) {
            t[i] = sc.nextInt();
        }
        int ans = 0;
        for (int i = 0; i < q; i++) {
            int l = 0;
            int r = n;
            while(1 < r-l){
                int mid = (r + l) / 2;
                if(t[i] < s[mid]) r = mid;
                else l = mid;
            }
            if(s[l] == t[i]) ans++;
        }
        System.out.println(ans);
        sc.close();

    }

} 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[q];
        for (int i = 0; i < q; i++) {
            t[i] = sc.nextInt();
        }
        int ans = 0;
        for (int i = 0; i < q; i++) {
            int l = 0;
            int r = n;
            while(1 < r-l){
                int mid = (r + l) / 2;
                if(t[i] < s[mid]) r = mid;
                else l = mid;
            }
            if(s[l] == t[i]) ans++;
        }
        System.out.println(ans);
        sc.close();

    } 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[q];
        for (int i = 0; i < q; i++) {
            t[i] = sc.nextInt();
        }
        int ans = 0;
        for (int i = 0; i < q; i++) {
            int l = 0;
            int r = n;
            while(1 < r-l){
                int mid = (r + l) / 2;
                if(t[i] < s[mid]) r = mid;
                else l = mid;
            }
            if(s[l] == t[i]) ans++;
        }
        System.out.println(ans);
        sc.close();

    } 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[q]; t new int[q] q 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 ans = 0; ans 0 for (int i = 0; i < q; i++) {
            int l = 0;
            int r = n;
            while(1 < r-l){
                int mid = (r + l) / 2;
                if(t[i] < s[mid]) r = mid;
                else l = mid;
            }
            if(s[l] == t[i]) ans++;
        } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
            int l = 0;
            int r = n;
            while(1 < r-l){
                int mid = (r + l) / 2;
                if(t[i] < s[mid]) r = mid;
                else l = mid;
            }
            if(s[l] == t[i]) ans++;
        } {
            int l = 0;
            int r = n;
            while(1 < r-l){
                int mid = (r + l) / 2;
                if(t[i] < s[mid]) r = mid;
                else l = mid;
            }
            if(s[l] == t[i]) ans++;
        } int l = 0; l 0 int r = n; r n while(1 < r-l){
                int mid = (r + l) / 2;
                if(t[i] < s[mid]) r = mid;
                else l = mid;
            } 1 < r-l 1 r-l r l {
                int mid = (r + l) / 2;
                if(t[i] < s[mid]) r = mid;
                else l = mid;
            } int mid = (r + l) / 2; mid (r + l) / 2 (r + l) r l 2 if(t[i] < s[mid]) r = mid;
                else l = mid; t[i] < s[mid] t[i] t i s[mid] s mid r = mid r mid l = mid l mid if(s[l] == t[i]) ans++; s[l] == t[i] s[l] s l t[i] t i ans++ ans System.out.println(ans) System.out.println System.out System System.out ans sc.close() sc.close sc 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[q];
        for (int i = 0; i < q; i++) {
            t[i] = sc.nextInt();
        }
        int ans = 0;
        for (int i = 0; i < q; i++) {
            int l = 0;
            int r = n;
            while(1 < r-l){
                int mid = (r + l) / 2;
                if(t[i] < s[mid]) r = mid;
                else l = mid;
            }
            if(s[l] == t[i]) ans++;
        }
        System.out.println(ans);
        sc.close();

    }

} 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[q];
        for (int i = 0; i < q; i++) {
            t[i] = sc.nextInt();
        }
        int ans = 0;
        for (int i = 0; i < q; i++) {
            int l = 0;
            int r = n;
            while(1 < r-l){
                int mid = (r + l) / 2;
                if(t[i] < s[mid]) r = mid;
                else l = mid;
            }
            if(s[l] == t[i]) ans++;
        }
        System.out.println(ans);
        sc.close();

    }

} Main
import 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[q];
        for (int i = 0; i < q; i++) {
            t[i] = sc.nextInt();
        }
        int ans = 0;
        for (int i = 0; i < q; i++) {
            int l = 0;
            int r = n;
            while(1 < r-l){
                int mid = (r + l) / 2;
                if(t[i] < s[mid]) r = mid;
                else l = mid;
            }
            if(s[l] == t[i]) ans++;
        }
        System.out.println(ans);
        sc.close();

    }

}

