N = int(input()) A = list(map(int, input().split())) if A[0] > A[-1]: print("No") exit() atoi = {a: i for i, a in enumerate(A)} seen = [0] * N ans = [] for a in range(1, A[0]): i = atoi[a] if seen[i]: continue p = i + 1 while p < N - 1: if seen[p]: break seen[p] = 1 ans.append(A[p]) p += 1 seen[i] = 1 ans.append(A[i]) for i in range(1, N): if seen[i]: continue ans.append(A[i]) print("Yes") print(*ans)