## https://yukicoder.me/problems/no/944 from collections import deque MAX_INT = 10 ** 18 def bisearch(N, D, f, low_index): if low_index == N: return N if D[-1] > f: return N low = low_index high = N - 1 while high - low > 1: mid = (high + low) //2 if D[mid] <= f: high = mid else: low = mid if D[low] <= f: return low else: return high def main(): N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) D = list(map(int, input().split())) D.sort(reverse=True) queue = deque() queue.append((0, 0)) min_d_index = [[MAX_INT for _ in range(N + 1)] for _ in range(N + 1)] min_d_index[0][0] = -1 for n in range(N + 1): for a_index in range(0, n + 1): b_index = n - a_index if min_d_index[a_index][b_index] == MAX_INT: continue d_index = min_d_index[a_index][b_index] if d_index == N - 1: continue # a_index + 1する new_a_index = a_index + 1 new_b_index = b_index f = A[new_a_index] + B[new_b_index] eat_index = bisearch(N, D, f, d_index + 1) if eat_index < N: min_d_index[new_a_index][new_b_index] = min(min_d_index[new_a_index][new_b_index], eat_index) new_a_index = a_index new_b_index = b_index + 1 f = A[new_a_index] + B[new_b_index] eat_index = bisearch(N, D, f, d_index + 1) if eat_index < N: min_d_index[new_a_index][new_b_index] = min(min_d_index[new_a_index][new_b_index], eat_index) answer = 0 for a in range(N + 1): for b in range(N + 1): if min_d_index[a][b] < MAX_INT: answer = max(answer, a + b) print(answer) if __name__ == "__main__": main()