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]; for(int i = Nb - 1; i >= 0; i--) { if(h > B[i]) { h = B[i]; max1 ++; for(int j = Nw - 1; j >= 0; j--) { if(h > W[j]) { max1++; h = W[j]; j = j - 1; break; } } } } int max2 = 1; int l2 = Nb - 2; int h2 = B[Nb - 1]; for(int i = Nw - 1; i >= 0; i--) { if(h2 > W[i]) { h2 = W[i]; max2 ++; for(int j = l2; j >= 0; j--) { if(h > B[j]) { max2++; h2 = B[j]; l2 = l2 - 1; break; } } } } int ans = Math.max(max1, max2); System.out.println(ans); } }