from itertools import permutations n = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) max_n = 0 ans = 0 for P in permutations(range(n)): res = 0 for i in range(n): if A[P[i]] >= B[i]: res += A[P[i]] - B[i] if res > max_n: max_n = res ans = 1 elif res == max_n: ans += 1 print(ans)