#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
#include<cstdio>
#include<cstdlib>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
//#define MOD 1000000007
#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

const double EPS = 1e-10;

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;

int main(){
    int N; cin >> N;
    vector<int> a(N);
    rep(i,N) cin >> a[i];
    int id = -1;
    rep(i,N){
        if(a[0] <= a[i] && a[i] <= a[N-1]){
            id = i;
            break;
        }
    }
    if(id == -1) cout << "No" << endl;
    else{
        cout << "Yes" << endl;
        vector<int> ans;
        vector<bool> used(N,false);
        rep(i,id){
            if(a[i] > a[id]){
                if(!used[a[i]-1]){
                    ans.push_back(a[i]);
                    used[a[i]-1] = true;
                }
            }
        }
        for(int i = N-1; i > id; i--){
            if(a[i] < a[id]){
                if(!used[a[i]-1]){
                    ans.push_back(a[i]);
                    used[a[i]-1] = true;
                }
            }
        }
        for(int i = id-1; i >= 0; i--){
            if(!used[a[i]-1]){
                ans.push_back(a[i]);
                used[a[i]-1] = true;
            }
        }
        repr(i,id+1,N){
            if(!used[a[i]-1]){
                ans.push_back(a[i]);
                used[a[i]-1] = true;
            }
        }

        rep(i,N-1){
            cout << ans[i] << " ";
        }
        cout << endl;
    }
}