#The solution in Python 3 is as follows:
S = int(input())
Q = sorted(map(int, input().split())) #sort the combat skills
N = sorted(map(int, input().split()))
b = 0
for j in range(S):
if Q[b] < N[j]: b+=1 #simply compare
print(b)
#Keep visiting for more solutions of SPOJ problems in Python 3.Thank you!!!
S = int(input())
Q = sorted(map(int, input().split())) #sort the combat skills
N = sorted(map(int, input().split()))
b = 0
for j in range(S):
if Q[b] < N[j]: b+=1 #simply compare
print(b)
#Keep visiting for more solutions of SPOJ problems in Python 3.Thank you!!!