from itertools import permutations as perm n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) mx = -1 for p in perm(a): mx = max(mx, sum(max(0, x-y) for x, y in zip(p, b))) cnt = 0 for p in perm(a): cnt += sum(max(0, x-y) for x, y in zip(p, b)) == mx print(cnt)