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