from itertools import* i=input i() A=list(map(int,i().split())) B=list(map(int,i().split())) x=c=0 for P in permutations(A): s=sum([max(a-b,0) for a,b in zip(P,B)]) if s>x:x=s;c=1 elif s==x:c+=1 print(c)