import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] arr = new int[n]; for (int i = 0; i < n; i++) { arr[i] = sc.nextInt(); } StringBuilder sb = new StringBuilder(); if (arr[0] < arr[n - 1]) { sb.append("Yes\n"); for (int i = 1; i < n - 1; i++) { if (arr[0] < arr[i]) { sb.append(arr[i]).append(" "); arr[i] = Integer.MAX_VALUE; } } for (int i = n - 2; i >= 1; i--) { if (arr[i] < arr[n - 1]) { sb.append(arr[i]).append(" "); } } sb.append(arr[0]); } else { sb.append("No"); } System.out.println(sb); } }