n = int(input()) a = [int(i) for i in input().split()] now = a[0] ans = [] idx = 1 for i in range(n*10): if idx >= n: break if a[idx] == 0: idx += 1 continue if now < a[idx]: ans.append(a[idx]) a[idx] = 0 else: if idx+1 >= n: break if a[idx] < a[idx+1]: ans.append(a[idx]) a[idx] = 0 idx += 1 if len(ans) != n-1: print("No") else: print("Yes") print(*ans)