using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.Text; using System.Text.RegularExpressions; using System.Linq; using System.IO; class Program { static private Magatro M = new Magatro(); static private void Main(string[]args) { M.Scan(); M.Solve(); } } public class Scanner { private string[] S; private int Index; private char Separator; public Scanner(char separator = ' ') { Index = 0; Separator = separator; S = new string[0]; } private string[] Line() { return Console.ReadLine().Split(Separator); } public string Next() { string result; if (Index >= S.Length) { S = Line(); Index = 0; } result = S[Index]; Index++; return result; } public int NextInt() { return int.Parse(Next()); } public double NextDouble() { return double.Parse(Next()); } public long NextLong() { return long.Parse(Next()); } } public class Magatro { private int Nw, Nb; private int[] W, B; public void Scan() { Scanner sc = new Scanner(); Nw = sc.NextInt(); W = new int[Nw]; for(int i = 0; i < Nw; i++) { W[i] = sc.NextInt(); } Nb = sc.NextInt(); B = new int[Nb]; for(int i = 0; i < Nb; i++) { B[i] = sc.NextInt(); } } public void Solve() { int ans; int black, white; Array.Sort(W,(a,b)=>-a.CompareTo(b)); Array.Sort(B,(a,b)=>-a.CompareTo(b)); int type = 0; white = 1; int block = W[0]; bool flag; while (true) { if (type == 0) { type = 1; flag = false; for (int i = 0; i < Nb; i++) { if (block > B[i]) { block = B[i]; white++; flag = true; break; } } if (flag) continue; break; } else { type = 0; flag = false; for (int i = 0; i < Nw; i++) { if (block > W[i]) { block = W[i]; white++; flag = true; break; } } if (flag) continue; break; } } black = 1; type = 1; block = B[0]; while (true) { if (type == 0) { type = 1; flag = false; for (int i = 0; i < Nb; i++) { if (block > B[i]) { block = B[i]; black++; flag = true; break; } } if (flag) continue; break; } else { type = 0; flag = false; for (int i = 0; i < Nw; i++) { if (block > W[i]) { block = W[i]; black++; flag = true; break; } } if (flag) continue; break; } } Console.WriteLine(Math.Max(black, white)); } }