import sys def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int,sys.stdin.readline().rstrip().split()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LI2(): return list(map(int,sys.stdin.readline().rstrip())) def S(): return sys.stdin.readline().rstrip() def LS(): return list(sys.stdin.readline().rstrip().split()) def LS2(): return list(sys.stdin.readline().rstrip()) N = I() A = LI() if A[0] > A[-1]: print('No') exit() print('Yes') ANS0 = [] ANS1 = [] a0 = A[0] for i in range(1,N-1): a = A[i] if a > a0: ANS0.append(a) else: ANS1.append(a) ANS = ANS0+ANS1[::-1]+[a0] print(*ANS)