import java.util.Arrays; import java.util.Scanner; class Main { public static void main(String[] args) { new Main().run(); } void run() { Scanner sc = new Scanner(System.in); int N=sc.nextInt(); long[] A=new long[N+1]; long[] B=new long[N+1]; long[] D=new long[N+1]; for(int i=0;i<=N;++i){ A[i]=sc.nextLong(); } for(int i=0;i<=N;++i){ B[i]=sc.nextLong(); } for(int i=0;iN)continue; if(D[i]<=A[a]+B[b]){ if(a>0) dp[i][a]|=dp[i-1][a-1]; if(b>0) dp[i][a]|=dp[i-1][a]; } } } int ans=0; for(int i=0;i<=N;++i){ for(int j=0;j<=N;++j){ if(dp[i][j]) ans=Math.max(ans,i); } } System.out.println(ans); } void tr(Object... objects) { System.out.println(Arrays.deepToString(objects)); } }