n = gets.to_s.to_i a = gets.to_s.split.map(&:to_i) b = gets.to_s.split.map(&:to_i) m = 0 ans = 0 a.permutation do |a| s = 0 i = 0 while i < n d = a[i] - b[i] s += d if d > 0 i += 1 end if s > m ans = 1 m = s elsif s == m ans += 1 end end puts ans