import java.util.Arrays;
import java.util.Scanner;
public class 六一儿童节 {
public static void main(String[] args) {
//接收输入
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] h = new int[n];
for (int i = 0; i < n; i++) {
h[i] = sc.nextInt();
}
int m = sc.nextInt();
int[] w = new int[m];
for (int i = 0; i < m; i++) {
w[i] = sc.nextInt();
}
//把w和h数组从小到大排序
Arrays.sort(w);
Arrays.sort(h);
int res = 0;
int i = 0, j = 0;
while (i < m && j < n) {
if(w[i] >= h[j]){
res++;
i++;
j++;
}else{
i++;
}
}
System.out.println(res);
}
}