#yuki1373 n=int(input()) a=list(map(int,input().split())) s=[(a[i],i)for i in range(n-1)] s.sort() X=[-1]*(n-1) for i in range(1,n): a,x=s[i-1] if i-a<0: print("NO") exit() X[x]=i-a+1 print("YES") print(*X,sep="\n")