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