N = gets.to_i A = gets.split.map(&:to_i) B = A.map.with_index { |a, i| [a, i] }.sort_by { |a, i| a } ans = Array.new(N - 1) min = 2 B.each do |a, i| if min < a + 1 puts 'NO' exit end ans[i] = min - a min += 1 end puts 'YES' puts ans