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