def main(): N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) D = list(map(int, input().split())) grid = [[0 for _ in range(N+1)] for _ in range(N+1)] for i in range(N+1): for j in range(N+1): grid[i][j] = A[i] + B[j] D.sort() ok = 0 ng = N+1 mid = (ok + ng) // 2 while ng - ok > 1: d = D[:mid] seen = [[0 for _ in range(N+1)] for _ in range(N+1)] st = [(0, 0)] seen[0][0] = 1 flg = 0 while st: i, j = st.pop() if i+j == mid: flg = 1 break if i+1 <= N: if seen[i+1][j] == 0: seen[i + 1][j] = 1 if grid[i+1][j] >= d[-(i+j+1)]: st.append((i+1, j)) if j+1 <= N: if seen[i][j+1] == 0: seen[i][j + 1] = 1 if grid[i][j+1] >= d[-(i+j+1)]: st.append((i, j+1)) if flg: ok = mid else: ng = mid mid = (ok+ng)//2 print(ok) if __name__ == '__main__': main()