from itertools import permutations n = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) dic = {} for x in permutations(A): t = 0 for i in range(n): t += max(x[i] - B[i], 0) dic.setdefault(t, 0) dic[t] += 1 for k, v in sorted(dic.items(), key=lambda x : (-x[0], -x[1])): print(v) break