import itertools def solve(N, a, b): junretsu = itertools.permutations(a, N) cnt = 0 saidai = 0 for x in junretsu: total = sum(max(x[i] - b[i], 0) for i in range(N)) if total > saidai: saidai = total cnt = 1 elif total == saidai: cnt += 1 return cnt N = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) print(solve(N, a, b))