#include using u64 = std::uint64_t; int main() { std::cin.tie(0)->sync_with_stdio(false); u64 N; scanf("%lu", &N); std::vector a(N), b(N); for (u64 u = 0; u < N; u++) scanf("%lu", &a[u]); for (u64 u = 0; u < N; u++) scanf("%lu", &b[u]); u64 ans = 1234567890; for (u64 d = 0; d < N; d++) { std::priority_queue, std::vector>, std::greater>> pq; for (u64 j = 0; j < N; j++) pq.push({a[j], 0}); u64 idx = d; u64 MAX = 0; for (u64 j = 0; j < N; j++) { u64 exp = pq.top().first; u64 cnt = pq.top().second; pq.pop(); cnt++; MAX = std::max(MAX, cnt); exp += (b[idx++] / 2); pq.push({exp, cnt}); if (idx >= N) idx -=N; } ans = std::min(ans, MAX); } printf("%lu\n", ans); return 0; }