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