import java.util.*;
import java.lang.Math;
public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        int A[];
        int ans=0;
        A=new int[N+2];
        for(int i=0;i<N;i++) A[i+1]=sc.nextInt();
        A[0]=-2000000000;
        A[N+1]=2000000000;
        int q=sc.nextInt();
        for(int i=0;i<q;i++){
            int key1=sc.nextInt();
            int key2=key1+1;
            int hi=N+1;
            int lo=-1;
            while(hi-lo>1){
                int mid=(hi+lo)/2;
                if(A[mid]>=key1) hi=mid;
                else lo=mid;
            }
            int res1=hi;
            hi=N+1;
            lo=-1;
            while(hi-lo>1){
                int mid=(hi+lo)/2;
                if(A[mid]>=key2) hi=mid;
                else lo=mid;
            }
            int res2=hi;
            if(res2-res1>0) ans++;
        }
        System.out.println(ans);
    }
} import java.util.*; util.* java import java.lang.Math; Math java.lang public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        int A[];
        int ans=0;
        A=new int[N+2];
        for(int i=0;i<N;i++) A[i+1]=sc.nextInt();
        A[0]=-2000000000;
        A[N+1]=2000000000;
        int q=sc.nextInt();
        for(int i=0;i<q;i++){
            int key1=sc.nextInt();
            int key2=key1+1;
            int hi=N+1;
            int lo=-1;
            while(hi-lo>1){
                int mid=(hi+lo)/2;
                if(A[mid]>=key1) hi=mid;
                else lo=mid;
            }
            int res1=hi;
            hi=N+1;
            lo=-1;
            while(hi-lo>1){
                int mid=(hi+lo)/2;
                if(A[mid]>=key2) hi=mid;
                else lo=mid;
            }
            int res2=hi;
            if(res2-res1>0) ans++;
        }
        System.out.println(ans);
    }
} Main public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        int A[];
        int ans=0;
        A=new int[N+2];
        for(int i=0;i<N;i++) A[i+1]=sc.nextInt();
        A[0]=-2000000000;
        A[N+1]=2000000000;
        int q=sc.nextInt();
        for(int i=0;i<q;i++){
            int key1=sc.nextInt();
            int key2=key1+1;
            int hi=N+1;
            int lo=-1;
            while(hi-lo>1){
                int mid=(hi+lo)/2;
                if(A[mid]>=key1) hi=mid;
                else lo=mid;
            }
            int res1=hi;
            hi=N+1;
            lo=-1;
            while(hi-lo>1){
                int mid=(hi+lo)/2;
                if(A[mid]>=key2) hi=mid;
                else lo=mid;
            }
            int res2=hi;
            if(res2-res1>0) ans++;
        }
        System.out.println(ans);
    } main {
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        int A[];
        int ans=0;
        A=new int[N+2];
        for(int i=0;i<N;i++) A[i+1]=sc.nextInt();
        A[0]=-2000000000;
        A[N+1]=2000000000;
        int q=sc.nextInt();
        for(int i=0;i<q;i++){
            int key1=sc.nextInt();
            int key2=key1+1;
            int hi=N+1;
            int lo=-1;
            while(hi-lo>1){
                int mid=(hi+lo)/2;
                if(A[mid]>=key1) hi=mid;
                else lo=mid;
            }
            int res1=hi;
            hi=N+1;
            lo=-1;
            while(hi-lo>1){
                int mid=(hi+lo)/2;
                if(A[mid]>=key2) hi=mid;
                else lo=mid;
            }
            int res2=hi;
            if(res2-res1>0) ans++;
        }
        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 int A[]; A int ans=0; ans 0 A=new int[N+2] A new int[N+2] N+2 N 2 for(int i=0;i<N;i++) A[i+1]=sc.nextInt(); int i=0; int i=0; i 0 i<N i N i++ i++ i A[i+1]=sc.nextInt(); A[i+1]=sc.nextInt() A[i+1] A i+1 i 1 sc.nextInt() sc.nextInt sc A[0]=-2000000000 A[0] A 0 -2000000000 2000000000 A[N+1]=2000000000 A[N+1] A N+1 N 1 2000000000 int q=sc.nextInt(); q sc.nextInt() sc.nextInt sc for(int i=0;i<q;i++){
            int key1=sc.nextInt();
            int key2=key1+1;
            int hi=N+1;
            int lo=-1;
            while(hi-lo>1){
                int mid=(hi+lo)/2;
                if(A[mid]>=key1) hi=mid;
                else lo=mid;
            }
            int res1=hi;
            hi=N+1;
            lo=-1;
            while(hi-lo>1){
                int mid=(hi+lo)/2;
                if(A[mid]>=key2) hi=mid;
                else lo=mid;
            }
            int res2=hi;
            if(res2-res1>0) ans++;
        } int i=0; int i=0; i 0 i<q i q i++ i++ i {
            int key1=sc.nextInt();
            int key2=key1+1;
            int hi=N+1;
            int lo=-1;
            while(hi-lo>1){
                int mid=(hi+lo)/2;
                if(A[mid]>=key1) hi=mid;
                else lo=mid;
            }
            int res1=hi;
            hi=N+1;
            lo=-1;
            while(hi-lo>1){
                int mid=(hi+lo)/2;
                if(A[mid]>=key2) hi=mid;
                else lo=mid;
            }
            int res2=hi;
            if(res2-res1>0) ans++;
        } {
            int key1=sc.nextInt();
            int key2=key1+1;
            int hi=N+1;
            int lo=-1;
            while(hi-lo>1){
                int mid=(hi+lo)/2;
                if(A[mid]>=key1) hi=mid;
                else lo=mid;
            }
            int res1=hi;
            hi=N+1;
            lo=-1;
            while(hi-lo>1){
                int mid=(hi+lo)/2;
                if(A[mid]>=key2) hi=mid;
                else lo=mid;
            }
            int res2=hi;
            if(res2-res1>0) ans++;
        } int key1=sc.nextInt(); key1 sc.nextInt() sc.nextInt sc int key2=key1+1; key2 key1+1 key1 1 int hi=N+1; hi N+1 N 1 int lo=-1; lo -1 1 while(hi-lo>1){
                int mid=(hi+lo)/2;
                if(A[mid]>=key1) hi=mid;
                else lo=mid;
            } hi-lo>1 hi-lo hi lo 1 {
                int mid=(hi+lo)/2;
                if(A[mid]>=key1) hi=mid;
                else lo=mid;
            } int mid=(hi+lo)/2; mid (hi+lo)/2 (hi+lo) hi lo 2 if(A[mid]>=key1) hi=mid;
                else lo=mid; A[mid]>=key1 A[mid] A mid key1 hi=mid hi mid lo=mid lo mid int res1=hi; res1 hi hi=N+1 hi N+1 N 1 lo=-1 lo -1 1 while(hi-lo>1){
                int mid=(hi+lo)/2;
                if(A[mid]>=key2) hi=mid;
                else lo=mid;
            } hi-lo>1 hi-lo hi lo 1 {
                int mid=(hi+lo)/2;
                if(A[mid]>=key2) hi=mid;
                else lo=mid;
            } int mid=(hi+lo)/2; mid (hi+lo)/2 (hi+lo) hi lo 2 if(A[mid]>=key2) hi=mid;
                else lo=mid; A[mid]>=key2 A[mid] A mid key2 hi=mid hi mid lo=mid lo mid int res2=hi; res2 hi if(res2-res1>0) ans++; res2-res1>0 res2-res1 res2 res1 0 ans++ ans 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){
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        int A[];
        int ans=0;
        A=new int[N+2];
        for(int i=0;i<N;i++) A[i+1]=sc.nextInt();
        A[0]=-2000000000;
        A[N+1]=2000000000;
        int q=sc.nextInt();
        for(int i=0;i<q;i++){
            int key1=sc.nextInt();
            int key2=key1+1;
            int hi=N+1;
            int lo=-1;
            while(hi-lo>1){
                int mid=(hi+lo)/2;
                if(A[mid]>=key1) hi=mid;
                else lo=mid;
            }
            int res1=hi;
            hi=N+1;
            lo=-1;
            while(hi-lo>1){
                int mid=(hi+lo)/2;
                if(A[mid]>=key2) hi=mid;
                else lo=mid;
            }
            int res2=hi;
            if(res2-res1>0) ans++;
        }
        System.out.println(ans);
    }
} public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        int A[];
        int ans=0;
        A=new int[N+2];
        for(int i=0;i<N;i++) A[i+1]=sc.nextInt();
        A[0]=-2000000000;
        A[N+1]=2000000000;
        int q=sc.nextInt();
        for(int i=0;i<q;i++){
            int key1=sc.nextInt();
            int key2=key1+1;
            int hi=N+1;
            int lo=-1;
            while(hi-lo>1){
                int mid=(hi+lo)/2;
                if(A[mid]>=key1) hi=mid;
                else lo=mid;
            }
            int res1=hi;
            hi=N+1;
            lo=-1;
            while(hi-lo>1){
                int mid=(hi+lo)/2;
                if(A[mid]>=key2) hi=mid;
                else lo=mid;
            }
            int res2=hi;
            if(res2-res1>0) ans++;
        }
        System.out.println(ans);
    }
} Main
import java.util.*;
import java.lang.Math;
public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        int A[];
        int ans=0;
        A=new int[N+2];
        for(int i=0;i<N;i++) A[i+1]=sc.nextInt();
        A[0]=-2000000000;
        A[N+1]=2000000000;
        int q=sc.nextInt();
        for(int i=0;i<q;i++){
            int key1=sc.nextInt();
            int key2=key1+1;
            int hi=N+1;
            int lo=-1;
            while(hi-lo>1){
                int mid=(hi+lo)/2;
                if(A[mid]>=key1) hi=mid;
                else lo=mid;
            }
            int res1=hi;
            hi=N+1;
            lo=-1;
            while(hi-lo>1){
                int mid=(hi+lo)/2;
                if(A[mid]>=key2) hi=mid;
                else lo=mid;
            }
            int res2=hi;
            if(res2-res1>0) ans++;
        }
        System.out.println(ans);
    }
}
