N = int(input()) A = tuple(map(int, input().split())) B = tuple(map(int, input().split())) D = sorted(map(int, input().split())) def isOK(x): dp = [[False] * (N + 1) for _ in range(N + 1)] dp[0][0] = True for a in range(N + 1): for b in range(x - a + 1): if a == b == 0: continue if A[a] + B[b] >= D[x - a - b]: if (a and dp[a - 1][b]) or (b and dp[a][b - 1]): dp[a][b] = True if a + b == x: return True return False l, r = 0, N + 1 while r - l > 1: m = (r + l) // 2 if isOK(m): l = m else: r = m print(l)