Last Updated: 26 Sep, 2025

Unique Element Report

Easy

Problem statement

You are given a list of N integers which may contain duplicate values. Your task is to analyze this list and produce a report containing two key pieces of information:


1) The total count of unique (distinct) elements in the list.


2) A sorted list of these unique elements in non-decreasing order.


Input Format:
The first line of input contains an integer 'N', the number of elements in the list.

The second line contains 'N' space-separated integers, representing the list of numbers.


Output Format:
The first line of output must be a single integer representing the count of unique elements.

The second line of output must contain the unique elements, sorted in non-decreasing order and separated by single spaces.


Note:
The most efficient way to solve this is to use a data structure that automatically handles uniqueness, such as a Set or a Hash Set.