import itertools import collections n=int(input()) a=list(map(int,input().split())) b=list(map(int,input().split())) cnt=collections.defaultdict(int) for p in itertools.permutations(range(n)): point=0 for i in range(n): if a[p[i]]>b[i]: point+=a[p[i]]-b[i] cnt[point]+=1 points=list(cnt.keys()) maxpoint=max(points) print(cnt[maxpoint])