n=int(input()) a=list(map(int,input().split())) b=list(map(int,input().split())) g=-1 c=0 from itertools import permutations for p in permutations(list(range(n))): ng=sum(max(a[p[i]]-b[i],0) for i in range(n)) if ng>g: g=ng c=1 elif ng==g: c+=1 print(c)