/KIVU2 - Khiêu vũ 2

<Problem>

http://ntucoder.net/Problem/Details/2215
              Uses Crt;
        Type arr=array[1..2000000] of int64;
        Var a,b:arr; n,i,j,kq,vt1,vt2:longint;
        
        Procedure Sort(l,r:longint;var a:arr);
        var i,j:longint; x,tg:int64;
        begin
            i:=l; j:=r; x:=a[(l+r) div 2];
            repeat
                while a[i]<x do inc(i); while (a[j]>x) do dec(j);
                if i<=j then begin tg:=a[i]; a[i]:=a[j]; a[j]:=tg; inc(i); dec(j) end;
            until i>j;
            if j>l then sort(l,j,a); if i<r then sort(i,r,a);
        end;
        Begin
            readln(n);
            for i:=1 to n do read(a[i]); sort(1,n,a);
            for i:=1 to n do read(b[i]); sort(1,n,b);
            vt1:=0; vt2:=0;
            for i:=1 to n do if a[i]>0 then begin vt1:=i; break; end;
            for i:=1 to n do if b[i]>0 then begin vt2:=i; break; end;
        
            if vt1=0 then vt1:=n+1;
            if vt2=0 then vt2:=n+1;
        
            //-oo - +oo
            kq:=0;
        
                i:=n; j:=1;
                while (i>=vt1) and (j<vt2) do
                begin
                    if abs(b[j])>a[i] then
                    begin
                        dec(i); inc(j);
                        inc(kq);
                    end
                    else
                    dec(i);
                end;
        
        
        
                i:=1; j:=n;
                while (i<vt1) and (j>=vt2) do
                begin
                    if abs(a[i])>b[j] then
                    begin
                        dec(j); inc(i);
                        inc(kq);
                    end
                    else
                    dec(j);
                end;
        
            writeln(kq);
            readln;
        
        End.