#include #define rep(i, n) for(int i = 0; i < (int)(n); ++i) using namespace std; using ll = long long; 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; } struct Unionfind { vector par; Unionfind(int n) : par(n) { for(int i = 0; i < n; ++i) par[i] = i; } int root(int x) { if(par[x] == x) return x; return par[x] = root(par[x]); } void unite(int x, int y) { int rx = root(x); int ry = root(y); if(rx == ry) return; par[rx] =ry; } bool same(int x, int y) { int rx = root(x); int ry = root(y); return rx == ry; } }; int main() { cin.tie(nullptr); ios_base::sync_with_stdio(false); int n; cin >> n; vector a(n+1); bool flag1 = true; bool equal_i = false; int iv = n; for(int i = 1; i <= n; ++i) { cin >> a[i]; if(equal_i && a[i] != 0) { cout << "No" << endl; return 0; } if(i > 1 && a[i] == i) { equal_i = true; iv = i; } if(a[i] > i) { cout << "No" << endl; return 0; } } int v = 0; for(int i = iv; i >= 1; --i) { if((a[i] + v) % i != 0) { cout << "No" << endl; return 0; } v += (a[i] + v) / i; } cout << "Yes" << endl; return 0; }