import copy, heapq if __name__ == '__main__': n = int(input()) abstract_ally = [(int(a), 0) for a in input().split()] enemy = [int(b) for b in input().split()] heapq.heapify(abstract_ally) answer = 0 for start in range(n): max_cnt = 0 ally = copy.copy(abstract_ally) for diff in range(n): level, cnt = heapq.heappop(ally) i = (start + diff) % n max_cnt = max(max_cnt, cnt + 1) heapq.heappush(ally, (level + enemy[i] // 2, cnt + 1)) answer = max(max_cnt, answer) print(answer)