import sys N = int(input()) a = list(map(int,input().split())) l = [(a[i],i) for i in range(N-1)] ans = [0] * (N-1) l.sort() for j in range(N-1): if l[j][0] > j+1: print('NO') exit() else: ans[l[j][1]] = j+2-l[j][0] print('YES') for i in ans: print(i)