import sys from itertools import permutations def I(): return int(sys.stdin.readline().rstrip()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) N = I() A,B = LI(),LI() ANS = [] for X in list(permutations([i for i in range(N)],N)): ANS.append(sum(max(0,A[X[i]]-B[i]) for i in range(N))) print(ANS.count(max(ANS)))