import heapq N = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) hq = [] for i in a: heapq.heappush(hq, [i, 0]) for i in b: l, c = heapq.heappop(hq) heapq.heappush(hq, [l + (i // 2), c + 1]) ans = 0 while hq: l, c = heapq.heappop(hq) ans = max(ans, c) print(ans)