#include<bits/stdc++.h>
using namespace std;
int n,a[105],b[105];
int main(){
freopen("proposal.in","r",stdin);
freopen("proposal.out","w",stdout);
scanf("%d",&n);
for (int i=1;i<=n;i++){
scanf("%d",&a[i]);
}
for (int i=1;i<=n;i++){
scanf("%d",&b[i]);
}
for (int i=n;i>=0;i--){
int flag=0;
for (int j=i,k=n;j>=1;j--,k--){
if (a[j]>b[k]){
flag=1;
}
}
if (flag==0){
cout<<n-i;
return 0;
}
}
return 0;
}