from heapq import * N = int(input()) A = [(a,0) for i,a in enumerate(list(map(int,input().split())))] B = list(map(int,input().split())) ans = 0 for i in range(N): Q = A[:] heapify(Q) for j in range(N): a,k = heappop(Q) a += B[(i+j)%N] // 2 heappush(Q,(a,k+1)) ans = max(ans,k+1) print(ans)