#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <complex>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;

int n, a[3001], b[3001], d[3001];
int dp[3001][3001];
int main() {
    cin >> n;
    for (int i = 0; i <= n; ++i) cin >> a[i];
    for (int i = 0; i <= n; ++i) cin >> b[i];
    for (int i = 1; i <= n; ++i) cin >> d[i];
    sort(&d[1], &d[n + 1]);
    int ans = 0;
    for (int i = 0; i <= n; ++i) {
        for (int j = 0; j + i <= n; ++j) {
            if (i == 0 && j == 0) {
                dp[i][j] = n + 1;
                continue;
            }
            int k = 0;
            if (i > 0) k = max(k, dp[i - 1][j]);
            if (j > 0) k = max(k, dp[i][j - 1]);
            auto l = lower_bound(&d[0], &d[k], a[i] + b[j] + 1) - &d[0] - 1;
            dp[i][j] = l;
            if (dp[i][j] >= 1) {
                ans = max(ans, i + j);
            }
        }
    }
    cout << ans << endl;
    return 0;
}