#include #define rep(i,n) for(int i=0; i<(int)(n); i++) using namespace std; using LL = long long; int main(){ int N; cin >> N; vector a(N), b(N); rep(i,N) cin >> a[i]; rep(i,N) cin >> b[i]; LL ans=0; vector c(N); rep(i,N) c[i]=i; do{ LL res=0; rep(i,N){ int A=a[c[i]]; rep(j,i+1) if(A>b[j]) res++; } ans=max(ans,res); }while(next_permutation(c.begin(),c.end())); cout << ans << endl; return 0; }