#include using namespace std::literals::string_literals; using i64 = std::int_fast64_t; using std::cout; using std::cerr; using std::endl; using std::cin; template std::vector make_v(size_t a){return std::vector(a);} template auto make_v(size_t a,Ts... ts){ return std::vector(ts...))>(a,make_v(ts...)); } int main() { int n; scanf("%d", &n); std::vector a(n); for(int i = 0; i < n; i++) scanf("%d", &a[i]); // prepare std::vector> vec; for(int i = 0; i < n; i++) vec.push_back({a[i], i}); sort(begin(vec), end(vec)); reverse(begin(vec), end(vec)); // solve if(a.back() == 1) { printf("NO\n"); return 0; } int bound = a.back(); std::vector ans; for(int i = n; i > bound; i--) ans.push_back(i); for(int i = n - 1; i >= 0; i--) { if(a[i] >= bound) continue; ans.push_back(a[i]); } printf("YES\n"); for(auto v: ans) printf("%d ", v); printf("\n"); return 0; }