from collections import defaultdict 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() ok = 0 ng = N+1 mid = (ok + ng) // 2 while ng - ok > 1: seen = defaultdict(int) st = [(0, 0)] seen[0] = 1 flg = 0 while st: i, j = st.pop() if i+1 <= N: if seen[(i+1) * (N+1) + j] == 0: seen[(i+1) * (N+1) + j] = 1 if A[i+1] + B[j] >= D[mid-(i+j+1)]: if i+j+1 == mid: flg = 1 break st.append((i+1, j)) if j+1 <= N: if seen[i * (N+1) + j+1] == 0: seen[i * (N+1) + j+1] = 1 if A[i] + B[j+1] >= D[mid-(i+j+1)]: if i+j+1 == mid: flg = 1 break st.append((i, j+1)) if flg: ok = mid else: ng = mid mid = (ok+ng)//2 print(ok) if __name__ == '__main__': main()