from itertools import permutations N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) L = [] for b in permutations(B): TOTAL = 0 for i, j in zip(A, b): if i > j: TOTAL += i - j else: TOTAL += 0 L += [TOTAL] MAX = max(L) ANS = 0 for b in permutations(B): TOTAL = 0 for i, j in zip(A, b): if i > j: TOTAL += i - j else: TOTAL += 0 if TOTAL == MAX: ANS += 1 print(ANS)