import heapq N = int(input()) A = list(map(int, input().split())) A.sort() B = [int(x)//2 for x in input().split()] H = [(a,0) for a in A] # heapq.heapify(H) min_max_cnt = N for i in range(N): h = H[:] for j in range(N): t = h[0] heapq.heapreplace(h, (B[j-i]+t[0], t[1]+1)) min_max_cnt = min(min_max_cnt, max(t[1] for t in h)) print(min_max_cnt)