n = int(input()) *a, = map(int,input().split()) s = sorted(range(n-1),key = lambda i:a[i]) ans = [0]*(n-1) for i in range(n-1): x = i+1-a[s[i]] if x < 0: print("NO") exit() ans[s[i]] = x+1 print("YES") print(*ans)