def lscan; gets.split.map(&:to_i); end

n = gets.to_i
aa = lscan
bb = lscan

best = -1
c = 0
aa.permutation do |ap|
  w = ap.zip(bb).map{|a,b| [a-b, 0].max }.reduce(:+)
  if best < w
    best = w
    c = 1
  elsif best == w
    c += 1
  end
end

p c