program FAIRPLAY;
const
maxN = 100000;
var
a, b: array[1..maxN] of longint;
n, i, j, res: longint;
procedure enter;
var
i: longint;
begin
readln(n);
for i := 1 to n do read(a[i]);
for i := 1 to n do read(b[i]);
end;
procedure sort(l, r: longint; var a: array of longint);
var
i, j, x, y: longint;
begin
i := l; j := r;
x := a[(l + r) div 2];
repeat
while a[i] < x do inc(i);
while x < a[j] do dec(j);
if i <= j then
begin
y := a[i]; a[i] := a[j]; a[j] := y;
inc(i); dec(j);
end;
until i > j;
if l < j then sort(l, j, a);
if i < r then sort(i, r, a);
end;
procedure solve;
var
i, j: longint;
begin
sort(1, n, a);
sort(1, n, b);
i := 1; j := 1; res := 0;
while (i <= n) and (j <= n) do
begin
if a[i] <= b[j] then
begin
inc(res);
inc(i); inc(j);
end
else inc(j);
end;
writeln(res);
end;
begin
assign(input, 'FAIRPLAY.INP'); reset(input);
assign(output, 'FAIRPLAY.OUT'); rewrite(output);
enter;
solve;
close(input); close(output);
end.