import itertools as t I,T,m=input,int,max def L():return list(map(T,I().split())) n,l=T(I()),[] a=L() b=L() for p in t.permutations(a,n): c=0 for i in range(n):c+=m(0,p[i]-b[i]) l.append(c) print(l.count(m(l)))