from heapq import heappush, heappop def solve(): n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) b = b + b ans = n for s in range(n): q = [] cnt = [0] * n for i, ai in enumerate(a): heappush(q, (ai, -1, i)) for j in range(s, s + n): ai, _, i = heappop(q) cnt[i] += 1 heappush(q, (ai + b[j] // 2, j, i)) ans = min(ans, max(cnt)) print(ans) solve()