N = int(input()) A = tuple(map(int, input().split())) B = tuple(map(int, input().split())) D = sorted(map(int, input().split())) dp = [[0] * (N + 1) for _ in range(N + 1)] for a in range(N + 1): cur = N for b in range(N + 1): while cur and A[a] + B[b] < D[cur - 1]: cur -= 1 dp[a][b] = cur for a in range(N, -1, -1): for b in range(N, -1, -1): tmp = max(dp[a + 1][b] if a != N else 0, dp[a][b + 1] if b != N else 0) dp[a][b] = min(dp[a][b], tmp + 1) print(max(dp[0][1], dp[1][0]))