import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int nw = sc.nextInt(); int[] wArr = new int[nw]; for (int i = 0; i < nw; i++) { wArr[i] = sc.nextInt(); } int nb = sc.nextInt(); int[] bArr = new int[nb]; for (int i = 0; i < nb; i++) { bArr[i] = sc.nextInt(); } Arrays.sort(wArr); Arrays.sort(bArr); int wIdx = nw - 1; int bIdx = nb - 1; int wCount = 0; int prev = Integer.MAX_VALUE; while (true) { if (wCount % 2 == 0) { if (wIdx < 0) { break; } if (wArr[wIdx] < prev) { wCount++; prev = wArr[wIdx]; wIdx--; } else { wIdx--; } } else { if (bIdx < 0) { break; } if (bArr[bIdx] < prev) { wCount++; prev = bArr[bIdx]; bIdx--; } else { bIdx--; } } } wIdx = nw - 1; bIdx = nb - 1; int bCount = 0; prev = Integer.MAX_VALUE; while (true) { if (bCount % 2 == 1) { if (wIdx < 0) { break; } if (wArr[wIdx] < prev) { bCount++; prev = wArr[wIdx]; wIdx--; } else { wIdx--; } } else { if (bIdx < 0) { break; } if (bArr[bIdx] < prev) { bCount++; prev = bArr[bIdx]; bIdx--; } else { bIdx--; } } } System.out.println(Math.max(wCount, bCount)); } }