import itertools N = int(input()) A = list(map(int,input().split())) B = list(map(int,input().split())) mp = 0 cnt = 0 for l in list(itertools.permutations(A)): point=0 for i in range(N): point+=max(0,l[i]-B[i]) if mp == point: cnt+=1 elif mp