import java.util.*;
import java.util.Arrays;
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] s = new long[n];
        for(int i = 0; i < n; i++){
            s[i] = sc.nextLong();
        }
        int q = sc.nextInt();
        long t = 0;
        
        int ans = 0;
        for(int i = 0; i < q; i++){
            t = sc.nextLong();
            int left = 0;
            int right = n;
            while(left < right){
                int mid = (left + right)/2;
                if(s[mid] == t){
                    ans ++;
                    break;
                }else if(t < s[mid]){
                    right = mid;
                }else{
                    left = mid + 1;
                }
            }
        }
        
        
        System.out.println(ans);
    }
}
 import java.util.*; util.* java import java.util.Arrays; Arrays java.util public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] s = new long[n];
        for(int i = 0; i < n; i++){
            s[i] = sc.nextLong();
        }
        int q = sc.nextInt();
        long t = 0;
        
        int ans = 0;
        for(int i = 0; i < q; i++){
            t = sc.nextLong();
            int left = 0;
            int right = n;
            while(left < right){
                int mid = (left + right)/2;
                if(s[mid] == t){
                    ans ++;
                    break;
                }else if(t < s[mid]){
                    right = mid;
                }else{
                    left = mid + 1;
                }
            }
        }
        
        
        System.out.println(ans);
    }
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] s = new long[n];
        for(int i = 0; i < n; i++){
            s[i] = sc.nextLong();
        }
        int q = sc.nextInt();
        long t = 0;
        
        int ans = 0;
        for(int i = 0; i < q; i++){
            t = sc.nextLong();
            int left = 0;
            int right = n;
            while(left < right){
                int mid = (left + right)/2;
                if(s[mid] == t){
                    ans ++;
                    break;
                }else if(t < s[mid]){
                    right = mid;
                }else{
                    left = mid + 1;
                }
            }
        }
        
        
        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] s = new long[n];
        for(int i = 0; i < n; i++){
            s[i] = sc.nextLong();
        }
        int q = sc.nextInt();
        long t = 0;
        
        int ans = 0;
        for(int i = 0; i < q; i++){
            t = sc.nextLong();
            int left = 0;
            int right = n;
            while(left < right){
                int mid = (left + right)/2;
                if(s[mid] == t){
                    ans ++;
                    break;
                }else if(t < s[mid]){
                    right = mid;
                }else{
                    left = mid + 1;
                }
            }
        }
        
        
        System.out.println(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc long[] s = new long[n]; s new long[n] n for(int i = 0; i < n; i++){
            s[i] = sc.nextLong();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            s[i] = sc.nextLong();
        } {
            s[i] = sc.nextLong();
        } s[i] = sc.nextLong() s[i] s i sc.nextLong() sc.nextLong sc int q = sc.nextInt(); q sc.nextInt() sc.nextInt sc long t = 0; t 0 int ans = 0; ans 0 for(int i = 0; i < q; i++){
            t = sc.nextLong();
            int left = 0;
            int right = n;
            while(left < right){
                int mid = (left + right)/2;
                if(s[mid] == t){
                    ans ++;
                    break;
                }else if(t < s[mid]){
                    right = mid;
                }else{
                    left = mid + 1;
                }
            }
        } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
            t = sc.nextLong();
            int left = 0;
            int right = n;
            while(left < right){
                int mid = (left + right)/2;
                if(s[mid] == t){
                    ans ++;
                    break;
                }else if(t < s[mid]){
                    right = mid;
                }else{
                    left = mid + 1;
                }
            }
        } {
            t = sc.nextLong();
            int left = 0;
            int right = n;
            while(left < right){
                int mid = (left + right)/2;
                if(s[mid] == t){
                    ans ++;
                    break;
                }else if(t < s[mid]){
                    right = mid;
                }else{
                    left = mid + 1;
                }
            }
        } t = sc.nextLong() t sc.nextLong() sc.nextLong sc int left = 0; left 0 int right = n; right n while(left < right){
                int mid = (left + right)/2;
                if(s[mid] == t){
                    ans ++;
                    break;
                }else if(t < s[mid]){
                    right = mid;
                }else{
                    left = mid + 1;
                }
            } left < right left right {
                int mid = (left + right)/2;
                if(s[mid] == t){
                    ans ++;
                    break;
                }else if(t < s[mid]){
                    right = mid;
                }else{
                    left = mid + 1;
                }
            } int mid = (left + right)/2; mid (left + right)/2 (left + right) left right 2 if(s[mid] == t){
                    ans ++;
                    break;
                }else if(t < s[mid]){
                    right = mid;
                }else{
                    left = mid + 1;
                } s[mid] == t s[mid] s mid t {
                    ans ++;
                    break;
                } ans ++ ans break; if(t < s[mid]){
                    right = mid;
                }else{
                    left = mid + 1;
                } t < s[mid] t s[mid] s mid {
                    right = mid;
                } right = mid right mid {
                    left = mid + 1;
                } left = mid + 1 left mid + 1 mid 1 System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] s = new long[n];
        for(int i = 0; i < n; i++){
            s[i] = sc.nextLong();
        }
        int q = sc.nextInt();
        long t = 0;
        
        int ans = 0;
        for(int i = 0; i < q; i++){
            t = sc.nextLong();
            int left = 0;
            int right = n;
            while(left < right){
                int mid = (left + right)/2;
                if(s[mid] == t){
                    ans ++;
                    break;
                }else if(t < s[mid]){
                    right = mid;
                }else{
                    left = mid + 1;
                }
            }
        }
        
        
        System.out.println(ans);
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] s = new long[n];
        for(int i = 0; i < n; i++){
            s[i] = sc.nextLong();
        }
        int q = sc.nextInt();
        long t = 0;
        
        int ans = 0;
        for(int i = 0; i < q; i++){
            t = sc.nextLong();
            int left = 0;
            int right = n;
            while(left < right){
                int mid = (left + right)/2;
                if(s[mid] == t){
                    ans ++;
                    break;
                }else if(t < s[mid]){
                    right = mid;
                }else{
                    left = mid + 1;
                }
            }
        }
        
        
        System.out.println(ans);
    }
} Main
import java.util.*;
import java.util.Arrays;
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] s = new long[n];
        for(int i = 0; i < n; i++){
            s[i] = sc.nextLong();
        }
        int q = sc.nextInt();
        long t = 0;
        
        int ans = 0;
        for(int i = 0; i < q; i++){
            t = sc.nextLong();
            int left = 0;
            int right = n;
            while(left < right){
                int mid = (left + right)/2;
                if(s[mid] == t){
                    ans ++;
                    break;
                }else if(t < s[mid]){
                    right = mid;
                }else{
                    left = mid + 1;
                }
            }
        }
        
        
        System.out.println(ans);
    }
}

