N = int(input()) A = list(map(int,input().split())) B = [[] for _ in range(N-1)] for i in range(N-1): B[i] = [A[i],i] B.sort() ans = [0] * (N-1) for i in range(N-1): a,j = B[i] if i - a < -1: print("NO") exit() ans[j] = i - a + 2 print("YES") for i in range(N-1): print(ans[i])