from bisect import* I,A=input,0 def L():return list(map(int,I().split())) n=int(I());a=sorted(L());b=L() for i in range(n):A+=n-max(i,bisect_right(a,b[i])) print(A)