class UnionFind: def __init__(self, n): self.par = [-1]*n self.rank = [0]*n def Find(self, x): if self.par[x] < 0: return x else: self.par[x] = self.Find(self.par[x]) return self.par[x] def Unite(self, x, y): x = self.Find(x) y = self.Find(y) if x != y: if self.rank[x] < self.rank[y]: self.par[y] += self.par[x] self.par[x] = y else: self.par[x] += self.par[y] self.par[y] = x if self.rank[x] == self.rank[y]: self.rank[x] += 1 def Same(self, x, y): return self.Find(x) == self.Find(y) def Size(self, x): return -self.par[self.Find(x)] n = int(input()) A = list(map(int, input().split())) B = [] for i, a in enumerate(A): B.append((a, i)) B.sort(reverse=True) uf = UnionFind(n) ans = [0]*(n-1) for i in reversed(range(1, n)): a, j = B[n-1-i] if i-a >= 0: uf.Unite(i-a, i) ans[j] = i-a+1 else: continue if uf.Size(0) == n: print('YES') print(*ans, sep='\n') else: print('NO')