_nw = gets.to_i w = gets.split.map(&:to_i).sort _nb = gets.to_i b = gets.split.map(&:to_i).sort ans = 0 [[w, b], [b.dup, w.dup]].each do |arr| i = tmp = 0 while (l = arr[i].pop) arr[i ^= 1].reject! { |e| e >= l } tmp += 1 end ans = tmp if ans < tmp end puts ans