package main import ( "bufio" "fmt" "os" "sort" "strconv" ) var sc = bufio.NewScanner(os.Stdin) var rdr = bufio.NewReaderSize(os.Stdin, 1000000) func main() { sc.Split(bufio.ScanWords) w := nextInt() ws := make([]int, w) for i := range ws { ws[i] = nextInt() } b := nextInt() bs := make([]int, b) for i := range bs { bs[i] = nextInt() } sort.Sort(sort.IntSlice(ws)) sort.Sort(sort.IntSlice(bs)) wb := []*[]int{&ws, &bs} counts, ends := []int{0, 0}, []int{21, 21} for i := 0; i < 2; i++ { for j := 0; j < 20; j++ { blocks := wb[j%2] if len(*blocks) == 0 || (*blocks)[0] >= ends[i] { break } for k := len(*blocks) - 1; k >= 0; k-- { if (*blocks)[k] < ends[i] { counts[i]++ ends[i] = (*blocks)[k] *blocks = (*blocks)[:k] break } } } ws, bs = ws[:w], bs[:b] wb = []*[]int{&bs, &ws} } if counts[0] > counts[1] { fmt.Println(counts[0]) return } fmt.Println(counts[1]) } func nextLine() string { sc.Scan() return sc.Text() } func nextInt() int { i, _ := strconv.Atoi(nextLine()) return i }