import sys input = sys.stdin.readline N=int(input()) x=int(input()) A0=list(map(int,input().split())) y=int(input()) B0=list(map(int,input().split())) length=0 A=[] B=[] ANS=0 while lengthB[i]: ind=i if ind==-1: B.pop() else: ANS+=1 B.pop(ind) A.pop(0) else: ind=-1 for i in range(len(A)): if A[i]>B[0]: ind=i if ind==-1: A.pop() else: ANS+=1 A.pop(ind) B.pop(0) length+=1 print(ANS)