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[:] max_cnt = 0 for j in range(N): t = heapq.heappop(h) heapq.heappush(h, (B[j-i]//2+t[0],t[1]+1)) max_cnt = max(max_cnt, t[1]+1) min_max_cnt = min(min_max_cnt, max_cnt) print(min_max_cnt)