n = int(input()) a = list(map(int, input().split())) a2 = [(a[i], i) for i in range(n - 1)] a2.sort(reverse=True) v = [0] * n v[0] = 1 ans = [0] * (n - 1) for i in range(n - 1): if a[a2[i][1]] + i < n: ans[a2[i][1]] = i + 1 else: exit(print("NO")) print("YES") print(*ans, sep="\n")