from itertools import permutations N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) x = 0 y = 0 for p in permutations(A, r=N): s = sum([p[i] - B[i] + abs(p[i] - B[i]) for i in range(N)]) if s > x: x = s y = 1 elif s == x: y += 1 print(y)