#include #include #include #include #include #include #include #include #include #include using namespace std; using ll = long long; using ull = unsigned long long; const ll inf = 1e9 + 7; int main(){ cin.tie(0); ios::sync_with_stdio(false); //cout << fixed << setprecison(15); int n; cin >> n; vector a(n); for(int i = 0; i < n; i++){ cin >> a[i]; } map b; int now = a[0]; vector ans; for(int i = 1; i < n - 1; i++){ if(now < a[i]){ b[i] = 1; ans.push_back(a[i]); }else{ now = a[i]; } } now = a[n - 1]; for(int i = n - 2; i >= 0; i--){ if(b[i] == 1)continue; if(now > a[i]){ b[i] = 1; ans.push_back(a[i]); }else{ cout << "No" << endl; return 0; } } cout << "Yes" << endl; for(int i = 0; i < ans.size(); i++){ cout << ans[i]; if(i != ans.size() - 1){ cout << " "; }else{ cout << endl; } } return 0; }