#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include // #include using ll = long long; using ld = long double; using namespace std; // using namespace atcoder; using P = pair; using Graph = vector>; using Priority = priority_queue, greater>;// 昇順 using Priority_pair = priority_queue, greater

>; // using mint_17 = modint1000000007; // using mint = modint998244353; #define mod 1000000007 #define MAX_WIDTH 60 #define MAX_HEIGHT 60 #define INF 1e18 #define MOD 998244353 #define PI 3.141592653589793 #define rep(i, s, n) for (ll i=(s);i<(n);i++) #define rrep(i, s, n) for (ll i=(n);i>=(s);i--) #define all(v) (v).begin(), (v).end() #define YES(n) cout << ((n) ? "YES" : "NO") << endl #define Yes(n) cout << ((n) ? "Yes" : "No") << endl #define pb(n) push_back(n) #define vi vector #define vll vector #define vs vector #define vc vector #define vp vector> #define mll map #define msl map #define COUT(n) cout << (n) << endl #define isInGrid(n, h, w) (0 <= (n) && (n) < (h) && 0 <= (n) && (n) < (w)) template inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } template inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } ll N, A[201010]; int main() { cin >> N; ll cnt = 0; vll B; rep(i, 0, N) { cin >> A[i]; if(A[i] == 0) cnt++; else { B.pb(A[i]); } } sort(all(B)); ll s = B.size(), mn = INF; priority_queue que; rep(i, 0, s-1) { mn = min(mn, B[i+1]-B[i]); que.push(B[i+1]-B[i]); } bool ok = true; rep(i, 0, cnt) { if(que.size() <= 0) break; ll t = que.top(); que.pop(); if(t <= 1) { COUT("Yes"); return 0; } if(t % 2 == 0) { que.push(t/2); que.push(t/2); } else { que.push(t/2); que.push((t/2)+1); } } while(!que.empty()) { ll t = que.top(); que.pop(); if(t > mn) { ok = false; } } Yes(ok); return 0; }