import java.util.Arrays; import java.util.HashSet; import java.util.LinkedList; import java.util.PriorityQueue; import java.util.Scanner; import java.util.Set; public class Main { public static class Block implements Comparable { boolean is_white; int size; public Block(boolean is_white, int size) { super(); this.is_white = is_white; this.size = size; } @Override public int compareTo(Block o) { return o.size - this.size; } } public static int playout(PriorityQueue queue, boolean first_blk){ boolean first = true; boolean prev_color = true; int prev_size = Integer.MAX_VALUE; int count = 0; while(!queue.isEmpty()){ Block blk = queue.poll(); if(first){ if(blk.is_white == first_blk){ continue; } else{ first = false; } }else if(prev_color == blk.is_white){ continue; }else if(prev_size <= blk.size){ continue; } prev_color = blk.is_white; prev_size = blk.size; count++; } return count; } public static void main(String[] args){ Scanner sc = new Scanner(System.in); PriorityQueue queue = new PriorityQueue(); final int Nw = sc.nextInt(); for(int i = 0; i < Nw; i++){ queue.add(new Block(true, sc.nextInt())); } final int Nb = sc.nextInt(); for(int i = 0; i < Nb; i++){ queue.add(new Block(false, sc.nextInt())); } System.out.println(Math.max(playout(new PriorityQueue(queue), true), playout(new PriorityQueue(queue), false))); } }