#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, u[50005] = {}, v[50005] = {};
cin >> n;
for (int i = 1; i <= n; i++)
cin >> u[i];
for (int i = 1; i <= n; i++)
cin >> v[i];
sort(u + 1, u + 1 + n);
sort(v + 1, v + 1 + n);
int ans = 0;
for (int i = 1, j = 1; i <= n; i++)
{
if (u[i] >= v[j])
{
j++;
ans++;
}
}
cout << ans;
return 0;
}