from itertools import permutations N=int(input()) a=list(map(int,input().split())) b=list(map(int,input().split())) t=0 bestscore=0 for x in list(permutations(a)): score=0 for i in range(N): score+=max((x[i]-b[i]),0) print(score) if(score==bestscore): t+=1 if(score>bestscore): bestscore=score t=1 print(t)