import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int Nw = scan.nextInt(); int []W = new int[Nw]; for(int i = 0; i < Nw; i++) { W[i] = scan.nextInt(); } int Nb = scan.nextInt(); int []B = new int[Nb]; for(int i = 0; i < Nb; i++) { B[i] = scan.nextInt(); } scan.close(); Arrays.sort(W); Arrays.sort(B); // 白が一番下の場合 int max1 = 1; int h = W[Nw - 1]; int flag = 0; for(int i = Nw - 1; i >= 0; i--) { switch(flag) { case 0: for(int j = Nb - 1; j >= 0; j--) { if(h > B[j]) { max1++; h = B[j]; flag = 1; break; } } break; case 1: for(int j = Nw - 2; j >= 0; j--) { if(h > W[j]) { max1 ++; flag = 0; h = W[j]; break; } } break; } } // 黒が一番下の場合 int max2 = 1; int h2 = B[Nb - 1]; int flag2 = 0; for(int i = Nb - 1; i >= 0; i--) { switch(flag2) { case 0: for(int j = Nw - 1; j >= 0; j--) { if(h2 > W[j]) { max2++; h2 = W[j]; flag2 = 1; break; } } break; case 1: for(int j = Nb - 2; j >= 0; j--) { if(h2 > B[j]) { max2 ++; flag2 = 0; h2 = B[j]; break; } } break; } } int ans = Math.max(max1, max2); System.out.println(ans); } }