from collections import defaultdict n = int(input()) a = list(map(int, input().split())) if not n - 1 <= sum(a) <= n * (n - 1) // 2: exit(print("NO")) d = defaultdict(int) ans = [] for i in a: if d[i] + i >= n: exit(print("NO")) ans.append(d[i] + 1) d[i] += 1 print("YES") print(*ans, sep="\n")