#include <bits/stdc++.h>
//#include <cmath>
typedef long long ll;
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define mod 1000000007
//#define lld long double
#define mii map<int, int>
#define mci map<char, int>
#define msi map<string, int>
#define pii pair<int, int>
#define ff first
#define ss second
#define bs(yup,x) binary_search(yup.begin(),yup.end(),x) //it will return bollean value
#define lb(yup,x) lower_bound(yup.begin(),yup.end(),x)  //it will return the adress of the number which is equal to or just greater than x ,and if it is equal to yup.end() than their in no such number exist
#define ub(yup,x) upper_bound(yup.begin(),yup.end(),x)
#define all(x) (x).begin(), (x).end()
#define rep(i,x,y) for(int i=x; i<y; i++)
#define fill(a,b) memset(a, b, sizeof(a))
#define vi vector<int>
#define setbits(x) __builtin_popcountll(x)
using namespace std;
const long long N=1000001,INF=2000000000000000000;
const long double EPS= 0.000000000001;

// calculate a^b%p
ll power(ll a, ll b, ll p)
    {
        if(a==0)
        return 0;
        ll res=1;
        //a%=p;
        while(b>0)
        {
            if(b&1)
            res=(res*a)%p;
            b>>=1;
            a=(a*a)%p;
        }
        return res;
    }


ll modinverse(ll n,ll p){
	return power(n,p-2,p);
}

ll nCr(ll n,ll r,ll p){
	ll f[n+1];
	f[0] = 1;
	for(ll i=1;i<=n;i++){
		f[i] = f[i-1]*i%p;
	}
	
	return (f[n]%p * modinverse(f[r],p)%p * modinverse(f[n-r],p)%p)%p;
}




int main() {
    IOS;
    //fill(isprime, true);
    //pre();
    int t;
    //cin>>t;
    t=1;
    while(t--){
		int n;
		cin>>n;
		int a[1005] = {0};
		for(int i=0;i<n;i++){
			int x;
			cin>>x;
			a[x] = 1;
		}
		int f=0;
		for(int i=1;i<=n;i++){
			if(a[i]==0){
				f=1;
				cout<<"No"<<endl;
				break;
			}
		}
		if(!f){
			cout<<"Yes"<<endl;
		}
	}
	
	return 0;
}
/* -> Written by <-
   -----------
  |K_A_Z_A_M_A|
  |___________|
  |    ___    |
  |   (^_^)   |
  |  /( | )\  |
  |____|_|____|
    H O A N G
*/

#include <bits/stdc++.h>

#define Task            ""
#define F               first
#define S               second
#define eb              emplace_back
#define bit(x, i)       ((x >> (i)) & 1)
#define debug(x)        cerr << #x << " is " << x << "\n";
//#define int             ll

using namespace std;
using ll = long long;

const int MOD = 1e9 + 7;
const int base = 131;
const int B = 32;
const int inf = 1e9 + 7;
const ll INF = 1e18 + 7;
const int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
const int dy8[] = {1, -1, 0, 1, -1, 0, 1, -1};
const int dx4[] = {0, 0, 1, -1};
const int dy4[] = {1, -1, 0, 0};

int n;
int a[100001];
int f[2][100001];
int g[2][100001];

void solve(int test_case) {
    cin >> n;
    for (int i = 1; i <= n; ++ i)
        cin >> a[i];
    f[0][1] = 0;
    f[1][1] = a[1];
    g[0][1] = 0;
    g[1][1] = 1;
    for (int i = 2; i <= n; ++ i) {
        g[0][i] = g[1][i-1];
        f[0][i] = ((ll)MOD * MOD + f[1][i-1] - (((ll)a[i] * g[0][i]) % MOD)) % MOD;
        g[1][i] = (g[0][i-1] + g[1][i-1]) % MOD;
        f[1][i] = ((ll)MOD * MOD + f[1][i-1] + f[0][i-1] + (((ll)a[i] * g[1][i]) % MOD)) % MOD;
    }
//    cout << f[1][1] << "\n";
    cout << (f[1][n] + f[0][n]) % MOD;
}

signed main(){
    cin.tie(0)->sync_with_stdio(0);
    if (fopen(".inp", "r")) {
        freopen(".inp", "r", stdin);
        freopen(".out", "w", stdout);
    }
    else if (fopen(Task".inp", "r")) {
        freopen(Task".inp", "r", stdin);
        freopen(Task".out", "w", stdout);
    }
    int test_case = 1;
//    cin >> test_case;
//    prepare();
    for (int i = 1; i <= test_case; ++ i) {
        solve(i);
//        bf();
    }
    return 0;
}
