from itertools import permutations from collections import defaultdict def main(): n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) d = defaultdict(int) for aa in permutations(a): tot = 0 for i in range(n): tot += max(aa[i] - b[i], 0) d[tot] += 1 print(d[max(d)]) if __name__ == "__main__": main()