import itertools N = int(input()) A = list(map(int,input().split())) B = list(map(int,input().split())) maxi = 0 ans = 0 for x in itertools.permutations(A,N): now = 0 cnt = 0 for i in x: if i > B[cnt]: now += i-B[cnt] cnt += 1 if now == maxi: ans += 1 elif now > maxi: maxi = now ans = 1 print (ans)