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")