#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define clr(a) memset(a, 0, sizeof(a))
#define sz(x) x.size()
#define rep(n) for (ll i = 0; i < n; i++)
#define repc(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, x, y) for (ll i = x; i < y; i++)
#define DEC(i, x, y) for (ll i = x; i >= y; i--)
#define all(v) v.begin(), v.end()
#define min3(a, b, c) min(a, min(b, c))
#define max3(a, b, c) max(a, max(b, c))
#define alla(a, n) a, a + n

using namespace std;

// Some typedef's
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;

ll lcm(ll a, ll b) { return (a * (b / __gcd(a, b))); }

// Some constants
const int inf = 1e9 + 7;
const double eps = 1e-6;
const double pi = 1.00 * acos(-1.00);
#ifndef ONLINE_JUDGE
#define debug(x) cerr << #x <<" "; _print(x); cerr << endl;
#else
#define debug(x)
#endif
void _print(int t) {cerr << t;}
void _print(string t) {cerr << t;}
void _print(char t) {cerr << t;}
void _print(ll t) {cerr << t;}
void _print(double t) {cerr << t;}
void _print(ull t) {cerr << t;}
template <class T, class V> void _print(pair <T, V> p);
template <class T> void _print(vector <T> v);
template <class T> void _print(set <T> v);
template <class T, class V> void _print(map <T, V> v);
template <class T> void _print(multiset <T> v);
template <class T, class V> void _print(pair <T, V> p) {cerr << "{"; _print(p.ff); cerr << ","; _print(p.ss); cerr << "}";}
template <class T> void _print(vector <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T> void _print(set <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T> void _print(multiset <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T, class V> void _print(map <T, V> v) {cerr << "[ "; for (auto i : v) {_print(i); cerr << " ";} cerr << "]";}
void solve()
{
    int n;
    cin>>n;
    map<int,int> mp;
    rep(n)
    {
        int x;
        cin>>x;
        mp[x]++;
    }   

for(int i=1;i<=n;i++)
{
    if(mp[i]==0)
    {
        cout<<"No\n";
        return;
    }
}
cout<<"Yes\n";
}
signed main()
{

    #ifndef ONLINE_JUDGE
    freopen("Error.txt", "w", stderr);
    freopen("Input.txt","r",stdin);
    freopen("Output.txt","w",stdout);
    #endif
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    ll t = 1;
    //cin >> t;
    while (t--)
    {
        solve();
    }
    

    return 0;
}
#include <algorithm>
#include <array>
#include <bitset>
#include <deque>
#include <forward_list>
#include <functional>
#include <iomanip>
#include <ios>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <math.h>
#include <ostream>
#include <queue>
#include <regex>
#include <set>
#include <string>
#include <string_view>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>


using namespace std;


#define int long long
#define si(v) size(v)
#define all(v) begin(v), end(v)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep2(i, n, m) for (int i = (n); i <= (m); ++i)
#define rep3(i, n, m) for (int i = (n); i >= (m); --i)


#define fi first
#define se second
#define em emplace
#define eb emplace_back
#define pb push_back


template <class S, class T> inline bool chmax(S &a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <class S, class T> inline bool chmin(S &a, T b) { if (a > b) { a = b; return 1; } return 0; }
template <class T> using pq  = priority_queue<T>;
template <class T> using pqg = priority_queue<T,vector<T>,greater<T>>;


using ll  = long long;
using ld  = long double;
using vi  = vector<int>;
using pii = pair<int,int>;
using vpi = vector<pii>;


constexpr ll INF   = 2000000000;
constexpr ll INFLL = 2000000000000000000;
constexpr ll MAX   = 500005;
constexpr ll MOD   = 1000000007;


signed main(void)
{
  ios::sync_with_stdio(false);
  cin.tie();
  cout << fixed << setprecision(15);


  int n; cin >> n;
  vi a(n);

  rep(i, n) cin >> a[i];

  vi s(n+1, 0);
  rep(i, n) s[i+1] += s[i] + a[i];

  vi mx(n+1, 0);
  rep(i, n) chmax(mx[i+1], max(s[i+1], mx[i]));

  int now = 0, ans = 0;
  rep(i, n) {
    int ma = now + mx[i+1];
    now += s[i+1];

    chmax(ans, ma);
  }

  cout << ans << endl;

  return (0);
}

