ans = [0] * ~-gets.to_i gets.split.map(&:to_i).each_with_index.to_a.sort.each_with_index do |(a, j), i| puts('NO') + exit if i + 1 < a ans[j] = i + 2 - a end puts 'YES', ans.join("\n")