n=int(input())
a=list(map(int,input().split()))
r=list(range(n))
r.sort(key=lambda i:-a[i])
o=[0]*n
h={}
while len(r):
	i=r.pop()
	x=a[i]
	if x-1 in h:
		o[i]=h[x-1]
		h[x]=i
		continue
	last=i
	for _ in range(x-1):
		if len(r)==0 or a[r[-1]]!=x:
			print('NO')
			exit()
		j=r.pop()
		o[last]=j
		last=j
	o[last]=i
	h[x]=i
 
print('YES')
print(*[x+1 for x in o])