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 cnt = 0;
        for(int i=0;i<q;i++){
            int t = sc.nextInt();
            int left = 0, right = n;
            while(left<right){
                int mid = (left+right)/2;
                if(S[mid]==t){
                    cnt++;
                    break;
                }
                else if(S[mid]>t) right = mid;
                else left = mid+1;
            }
        }
        System.out.println(cnt);
    }
} 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 cnt = 0;
        for(int i=0;i<q;i++){
            int t = sc.nextInt();
            int left = 0, right = n;
            while(left<right){
                int mid = (left+right)/2;
                if(S[mid]==t){
                    cnt++;
                    break;
                }
                else if(S[mid]>t) right = mid;
                else left = mid+1;
            }
        }
        System.out.println(cnt);
    }
} 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 cnt = 0;
        for(int i=0;i<q;i++){
            int t = sc.nextInt();
            int left = 0, right = n;
            while(left<right){
                int mid = (left+right)/2;
                if(S[mid]==t){
                    cnt++;
                    break;
                }
                else if(S[mid]>t) right = mid;
                else left = mid+1;
            }
        }
        System.out.println(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 cnt = 0;
        for(int i=0;i<q;i++){
            int t = sc.nextInt();
            int left = 0, right = n;
            while(left<right){
                int mid = (left+right)/2;
                if(S[mid]==t){
                    cnt++;
                    break;
                }
                else if(S[mid]>t) right = mid;
                else left = mid+1;
            }
        }
        System.out.println(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] S i sc.nextInt() sc.nextInt sc int q = sc.nextInt(); q sc.nextInt() sc.nextInt sc int cnt = 0; cnt 0 for(int i=0;i<q;i++){
            int t = sc.nextInt();
            int left = 0, right = n;
            while(left<right){
                int mid = (left+right)/2;
                if(S[mid]==t){
                    cnt++;
                    break;
                }
                else if(S[mid]>t) right = mid;
                else left = mid+1;
            }
        } int i=0; int i=0; i 0 i<q i q i++ i++ i {
            int t = sc.nextInt();
            int left = 0, right = n;
            while(left<right){
                int mid = (left+right)/2;
                if(S[mid]==t){
                    cnt++;
                    break;
                }
                else if(S[mid]>t) right = mid;
                else left = mid+1;
            }
        } {
            int t = sc.nextInt();
            int left = 0, right = n;
            while(left<right){
                int mid = (left+right)/2;
                if(S[mid]==t){
                    cnt++;
                    break;
                }
                else if(S[mid]>t) right = mid;
                else left = mid+1;
            }
        } int t = sc.nextInt(); t sc.nextInt() sc.nextInt sc int left = 0 left 0 right = n; right n while(left<right){
                int mid = (left+right)/2;
                if(S[mid]==t){
                    cnt++;
                    break;
                }
                else if(S[mid]>t) right = mid;
                else left = mid+1;
            } left<right left right {
                int mid = (left+right)/2;
                if(S[mid]==t){
                    cnt++;
                    break;
                }
                else if(S[mid]>t) right = mid;
                else left = mid+1;
            } int mid = (left+right)/2; mid (left+right)/2 (left+right) left right 2 if(S[mid]==t){
                    cnt++;
                    break;
                }
                else if(S[mid]>t) right = mid;
                else left = mid+1; S[mid]==t S[mid] S mid t {
                    cnt++;
                    break;
                } cnt++ cnt break; if(S[mid]>t) right = mid;
                else left = mid+1; S[mid]>t S[mid] S mid t right = mid right mid left = mid+1 left mid+1 mid 1 System.out.println(cnt) System.out.println System.out System System.out cnt 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 cnt = 0;
        for(int i=0;i<q;i++){
            int t = sc.nextInt();
            int left = 0, right = n;
            while(left<right){
                int mid = (left+right)/2;
                if(S[mid]==t){
                    cnt++;
                    break;
                }
                else if(S[mid]>t) right = mid;
                else left = mid+1;
            }
        }
        System.out.println(cnt);
    }
} 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 cnt = 0;
        for(int i=0;i<q;i++){
            int t = sc.nextInt();
            int left = 0, right = n;
            while(left<right){
                int mid = (left+right)/2;
                if(S[mid]==t){
                    cnt++;
                    break;
                }
                else if(S[mid]>t) right = mid;
                else left = mid+1;
            }
        }
        System.out.println(cnt);
    }
} 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 cnt = 0;
        for(int i=0;i<q;i++){
            int t = sc.nextInt();
            int left = 0, right = n;
            while(left<right){
                int mid = (left+right)/2;
                if(S[mid]==t){
                    cnt++;
                    break;
                }
                else if(S[mid]>t) right = mid;
                else left = mid+1;
            }
        }
        System.out.println(cnt);
    }
}
