from itertools import permutations n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) ma = 0 ans = 0 for x in permutations(a): t = 0 for i in range(n): t += max(0, x[i] - b[i]) if t > ma: ans = 1 ma = t elif t == ma: ans += 1 print(ans)