import heapq import copy N = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) ahq = [] for i in a: heapq.heappush(ahq, [i, 0]) ans = 10 ** 18 for i in range(N): tans = 0 hq = copy.deepcopy(ahq) for j in range(i, N + i): l, c = heapq.heappop(hq) heapq.heappush(hq, [l + (b[j % N] // 2), c + 1]) while hq: l, c = heapq.heappop(hq) tans = max(tans, c) ans = min(ans, tans) print(tans)