#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

#define fast                     ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define ll                       long long
#define ld                       long double
#define endl                     '\n'
#define all(A)                   (A).begin(),(A).end()
#define traceA(A,x)              cerr<<#A<<": ";for(int i = 0; i < (x) ; ++i) cerr<<A[i]<<' ';cerr<<endl
#define traceV(A)                cerr<<#A<<": ";for(auto i:A)cerr<<i<<' ';cerr<<endl
#define traceM(A,n,m)            cerr<<#A<<": "<<endl;for(int i = 0; i < (n) ; ++i){for(int j = 0; j < (m) ; ++j) cerr << A[i][j] << ' ';cerr << endl;}

#define TRACE
#ifdef TRACE
#define trace(...) __f__(#__VA_ARGS__,__VA_ARGS__)
template<typename Arg1> void __f__(const char* name,Arg1&& arg1){cerr<<name<<" : "<<arg1<<endl;}
template <typename Arg1,typename... Args> void __f__(const char* names,Arg1&& arg1,Args&&... args){const char* comma=strchr(names+1,',');cerr.write(names,comma-names)<<" : "<<arg1<<" | ";__f__(comma+1,args...);}
#else
// #define trace(...) 1
#endif

const ll mod = 1e9+7;
inline ll add(ll a,ll b){a+=b;if(a>=mod)a-=mod;return a;}
inline ll sub(ll a,ll b){a-=b;if(a<0)a+=mod;return a;}
inline ll mul(ll a,ll b){return (a*1ll*b)%mod;}
inline ll power(ll a,ll b){ll rt=1;while(b>0){if(b&1)rt=mul(rt,a);a=mul(a,a);b>>=1;}return rt;}
inline ll inv(ll a){return power(a,mod-2);}

const ll inf = 1e18+77;
const int MOD = 1e9+7;
const int N = 2e5 + 77;

int A[N];

void sol(){
    int n; cin >> n;
    for(int i = 0 ; i < n ; ++i) cin >> A[i];
    sort(A,A+n);
    for(int i = 0 ; i < n ; ++i){
        if(A[i] != i+1){
            cout << "No" << endl;
            return;
        }
    }
    cout << "Yes" << endl;
}

int32_t main(){
    fast;
    int t  = 1;
    // cin >> t;
    while(t--) sol();
    return 0;
}
#include <bits/stdc++.h>
using namespace std;

int main() {
int N;
int count =0;
cin>>N;
vector<int> vec(N);
for (int i = 0; i < N; i++) {cin >> vec.at(i);}
sort(vec.begin(), vec.end());
for(int n=0;n<N;n++){if(vec.at(n)!=n+1){count++;break;}}
if(count==0){cout<<"Yes"<<endl;}
else if(count==1){cout<<"No"<<endl;}
}