import java.util.*; public class Exercise127{ public static void main (String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] w = new int[n]; for(int i = 0; i < n; i++){ w[i] = sc.nextInt(); } Arrays.sort(w); n = sc.nextInt(); int[] b = new int[n]; for(int i = 0; i < n; i++){ b[i] = sc.nextInt(); } Arrays.sort(b); System.out.println(Math.max(build(w, b), build(b, w))); } private static int build(int[] first, int[] second){ int top = first[first.length - 1]; int count = 1; boolean f = true; for(int i = second.length - 1; i >= 0; i--){ if(second[i] < top && f){ top = second[i]; count++; f = false; for(int j = first.length - 1; j >=0; j--){ if(first[j] < top){ top = first[j]; count++; f = true; break; } } } } return count; } }