import sys sys.setrecursionlimit(10**6) N = int(input()) a = list(map(int,input().split())) if a[0] > a[-1]: print("No") exit() print('Yes') l = [i-1 for i in range(N)] r = [i+1 for i in range(N)] node = [0]*N node[0] = 1 node[-1] = 1 ans = [] def func(x): if node[x]: return if a[l[x]] < a[x]: ans.append(a[x]) node[x] = 1 r[l[x]] = r[x] l[r[x]] = l[x] if a[x] < a[r[x]]: ans.append(a[x]) node[x] = 1 r[l[x]] = r[x] l[r[x]] = l[x] func(l[x]) func(r[x]) func(1) for i in ans: print(i,end=" ") print(a[0])