from heapq import heapify, heapreplace def main(): """ main """ N = int(input()) FRIENDS = list(map(lambda x: (int(x), 0), input().split())) ENEMIES = list(map(lambda x: int(x)//2, input().split())) # origin_friends = FRIENDS[:] heapify(FRIENDS) max_value = float('inf') # # 的の順番ごとに一つ一つ確認していく for n in range(N): friends = FRIENDS[:] for enemy in ENEMIES[n:] + ENEMIES[:n]: lv, cnt = friends[0] heapreplace(friends, (lv+enemy, cnt+1)) max_value = min(max_value, max(cnt for lv, cnt in friends)) print(max_value) main()