import itertools n = int(input()) alst = list(map(int, input().split())) blst = list(map(int, input().split())) max_ = -1 ans = 0 for lst in itertools.permutations(alst): total = 0 for a, b in zip(lst, blst): total += max(a - b, 0) if max_ == total: ans += 1 elif max_ < total: max_ = total ans = 1 print(ans)