#include "bits/stdc++.h" using namespace std; using ll = long long; void Main() { int N; cin >> N; vector A(N, 0), B(N, 0); for (int i = 0; i < N; ++i) { cin >> A[i]; } for (int i = 0; i < N; ++i) { cin >> B[i]; } typedef pair, int> level_nb_id; int ans = N; for (int i = 0; i < N; ++i) { priority_queue, greater> q; for (int j = 0; j < N; ++j) { q.push(make_pair(make_pair(A[j], 0), j)); } for (int j = 0; j < N; ++j) { level_nb_id curr = q.top(); q.pop(); curr.first.first += B[(i + j) % N] / 2; curr.first.second += 1; q.push(curr); } int temp = 0; for (int j = 0; j < N; ++j) { temp = max(temp, q.top().first.second); q.pop(); } ans = min(ans, temp); } cout << ans << endl; } int main() { std::cout << std::fixed << std::setprecision(15); Main(); return 0; }