#include using namespace std; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int n; cin >> n; vector a(n + 1); for (auto&& e : a) { cin >> e; } vector b(n + 1); for (auto&& e : b) { cin >> e; } vector d(n); for (auto&& e : d) { cin >> e; } sort(begin(d), end(d)); auto chk = [&](int m) { vector c(begin(d), begin(d) + m); reverse(begin(c), end(c)); vector< bitset<3001> > dp(m + 1); dp[0][0] = true; for (int x = 0; x <= m; ++x) { for (int y = 0; x + y <= m; ++y) { if (not dp[x][y]) { continue; } if (x + y < m and a[x + 1] + b[y] >= c[x + y]) { dp[x + 1][y] = true; } if (x + y < m and a[x] + b[y + 1] >= c[x + y]) { dp[x][y + 1] = true; } } } for (int x = 0; x <= m; ++x) { if (dp[x][m - x]) { return true; } } return false; }; int ok = 0, ng = n + 1; while (ng - ok > 1) { int mid = (ok + ng) / 2; (chk(mid) ? ok : ng) = mid; } cout << ok << '\n'; }