nw = gets.to_i w = gets.split.map(&:to_i) nb = gets.to_i b = gets.split.map(&:to_i) w.sort!{|a, b| b <=> a} b.sort!{|a, b| b <=> a} wi = 0 bi = 0 block = 21 c1 = 0 while true do while wi < nw if w[wi] < block block = w[wi] c1 += 1 break end wi += 1 end break if wi >= nw wi += 1 while bi < nb if b[bi] < block block = b[bi] c1 += 1 break end bi += 1 end break if bi >= nb bi += 1 end wi = 0 bi = 0 block = 21 c2 = 0 while true do while bi < nb if b[bi] < block block = b[bi] c2 += 1 break end bi += 1 end break if bi >= nb bi += 1 while wi < nw if w[wi] < block block = w[wi] c2 += 1 break end wi += 1 end break if wi >= nw wi += 1 end puts (c1 > c2) ? c1 : c2