import sys from itertools import permutations from collections import Counter sys.setrecursionlimit(10**7) def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int,sys.stdin.readline().rstrip().split()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LI2(): return list(map(int,sys.stdin.readline().rstrip())) def S(): return sys.stdin.readline().rstrip() def LS(): return list(sys.stdin.readline().rstrip().split()) def LS2(): return list(sys.stdin.readline().rstrip()) N = I() A = LI() B = LI() ANS = [] for X in list(permutations([i for i in range(N)],N)): a = 0 for i in range(N): a += max(0,A[X[i]]-B[i]) ANS.append(a) count = Counter(ANS) x = list(count.keys())[0] print(count[x])