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