def solve(): N = int(input()) a = [int(x) for x in input().split(" ")] last = a.pop() cnt = sum([x < y for x, y in zip(a, a[1:])]) if last < N - cnt: print("No") return print("Yes") res = [] for _ in range(cnt): for i, v in enumerate(zip(a, a[1:])): x, y = v if x > y: continue if last < y: res.append(a.pop(i+1)) break res += list(reversed(a)) print(" ".join([str(x) for x in res])) if __name__ == "__main__": solve()