from itertools import permutations

N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))

Max=-1
Count=0
for alpha in permutations(A):
    X=0
    for i in range(N):
        X+=max(0,alpha[i]-B[i])

    if X==Max:
        Count+=1
    elif X>Max:
        Max=X
        Count=1
print(Count)