# coding: utf-8 import heapq N = int(input()) A = list(map(int, input().split())) B = [int(x)/2 for x in input().split()] * 2 A.sort() Aheap = [(a, 0) for a in A] ans = N for i in range(N): a = Aheap[:] for j in range(N): lv, c = a[0] heapq.heapreplace(a, (lv+B[i+j], c+1)) ans=min(ans, max(c for lv, c in a)) print(ans)