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 print(dic[max(dic)])