import java.util.Scanner;
public class Main {
    public static void main(String[] args) throws Exception {
        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,mid,r,l,cnt=0;
        for(int i = 0; i < q; i++){
            t = sc.nextInt();
            l = 0;
            r = n - 1;
            while ( l <= r ){
                mid = (l + r) / 2;
                if(s[mid] == t) {
                    cnt++;
                    break;
                }
                else if (s[mid] > t) {
                    r = mid - 1;
                }
                else {
                    l = mid + 1;
                }
            }
        }
        System.out.printf("%d%n",cnt);
    }
}
 import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) throws Exception {
        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,mid,r,l,cnt=0;
        for(int i = 0; i < q; i++){
            t = sc.nextInt();
            l = 0;
            r = n - 1;
            while ( l <= r ){
                mid = (l + r) / 2;
                if(s[mid] == t) {
                    cnt++;
                    break;
                }
                else if (s[mid] > t) {
                    r = mid - 1;
                }
                else {
                    l = mid + 1;
                }
            }
        }
        System.out.printf("%d%n",cnt);
    }
} Main public static void main(String[] args) throws Exception {
        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,mid,r,l,cnt=0;
        for(int i = 0; i < q; i++){
            t = sc.nextInt();
            l = 0;
            r = n - 1;
            while ( l <= r ){
                mid = (l + r) / 2;
                if(s[mid] == t) {
                    cnt++;
                    break;
                }
                else if (s[mid] > t) {
                    r = mid - 1;
                }
                else {
                    l = mid + 1;
                }
            }
        }
        System.out.printf("%d%n",cnt);
    } 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,mid,r,l,cnt=0;
        for(int i = 0; i < q; i++){
            t = sc.nextInt();
            l = 0;
            r = n - 1;
            while ( l <= r ){
                mid = (l + r) / 2;
                if(s[mid] == t) {
                    cnt++;
                    break;
                }
                else if (s[mid] > t) {
                    r = mid - 1;
                }
                else {
                    l = mid + 1;
                }
            }
        }
        System.out.printf("%d%n",cnt);
    } 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 t mid mid r r l l cnt=0; cnt 0 for(int i = 0; i < q; i++){
            t = sc.nextInt();
            l = 0;
            r = n - 1;
            while ( l <= r ){
                mid = (l + r) / 2;
                if(s[mid] == t) {
                    cnt++;
                    break;
                }
                else if (s[mid] > t) {
                    r = mid - 1;
                }
                else {
                    l = mid + 1;
                }
            }
        } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
            t = sc.nextInt();
            l = 0;
            r = n - 1;
            while ( l <= r ){
                mid = (l + r) / 2;
                if(s[mid] == t) {
                    cnt++;
                    break;
                }
                else if (s[mid] > t) {
                    r = mid - 1;
                }
                else {
                    l = mid + 1;
                }
            }
        } {
            t = sc.nextInt();
            l = 0;
            r = n - 1;
            while ( l <= r ){
                mid = (l + r) / 2;
                if(s[mid] == t) {
                    cnt++;
                    break;
                }
                else if (s[mid] > t) {
                    r = mid - 1;
                }
                else {
                    l = mid + 1;
                }
            }
        } t = sc.nextInt() t sc.nextInt() sc.nextInt sc l = 0 l 0 r = n - 1 r n - 1 n 1 while ( l <= r ){
                mid = (l + r) / 2;
                if(s[mid] == t) {
                    cnt++;
                    break;
                }
                else if (s[mid] > t) {
                    r = mid - 1;
                }
                else {
                    l = mid + 1;
                }
            } l <= r l r {
                mid = (l + r) / 2;
                if(s[mid] == t) {
                    cnt++;
                    break;
                }
                else if (s[mid] > t) {
                    r = mid - 1;
                }
                else {
                    l = mid + 1;
                }
            } mid = (l + r) / 2 mid (l + r) / 2 (l + r) l r 2 if(s[mid] == t) {
                    cnt++;
                    break;
                }
                else if (s[mid] > t) {
                    r = mid - 1;
                }
                else {
                    l = mid + 1;
                } s[mid] == t s[mid] s mid t {
                    cnt++;
                    break;
                } cnt++ cnt break; if (s[mid] > t) {
                    r = mid - 1;
                }
                else {
                    l = mid + 1;
                } s[mid] > t s[mid] s mid t {
                    r = mid - 1;
                } r = mid - 1 r mid - 1 mid 1 {
                    l = mid + 1;
                } l = mid + 1 l mid + 1 mid 1 System.out.printf("%d%n",cnt) System.out.printf System.out System System.out "%d%n" cnt String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        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,mid,r,l,cnt=0;
        for(int i = 0; i < q; i++){
            t = sc.nextInt();
            l = 0;
            r = n - 1;
            while ( l <= r ){
                mid = (l + r) / 2;
                if(s[mid] == t) {
                    cnt++;
                    break;
                }
                else if (s[mid] > t) {
                    r = mid - 1;
                }
                else {
                    l = mid + 1;
                }
            }
        }
        System.out.printf("%d%n",cnt);
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        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,mid,r,l,cnt=0;
        for(int i = 0; i < q; i++){
            t = sc.nextInt();
            l = 0;
            r = n - 1;
            while ( l <= r ){
                mid = (l + r) / 2;
                if(s[mid] == t) {
                    cnt++;
                    break;
                }
                else if (s[mid] > t) {
                    r = mid - 1;
                }
                else {
                    l = mid + 1;
                }
            }
        }
        System.out.printf("%d%n",cnt);
    }
} Main
import java.util.Scanner;
public class Main {
    public static void main(String[] args) throws Exception {
        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,mid,r,l,cnt=0;
        for(int i = 0; i < q; i++){
            t = sc.nextInt();
            l = 0;
            r = n - 1;
            while ( l <= r ){
                mid = (l + r) / 2;
                if(s[mid] == t) {
                    cnt++;
                    break;
                }
                else if (s[mid] > t) {
                    r = mid - 1;
                }
                else {
                    l = mid + 1;
                }
            }
        }
        System.out.printf("%d%n",cnt);
    }
}

