#P1059. [NOIP 2006 普及组] 明明的随机数

[NOIP 2006 普及组] 明明的随机数

Description

Mingming wants to invite some classmates at school to fill out a questionnaire. For objectivity, he first uses a computer to generate NN random integers between 11 and 10001000 (N100N \leq 100). For any duplicates, keep exactly one occurrence and remove the rest; different numbers correspond to different students' ID numbers. Then sort these numbers in ascending order, and visit the classmates in the sorted order. Please help Mingming remove duplicates and sort the numbers.

Input Format

The input has two lines.
The first line contains a positive integer, the number NN of generated random integers.
The second line contains NN positive integers separated by spaces, which are the generated random integers.

Output Format

The output also has two lines.
The first line contains a positive integer MM, the number of distinct random integers.
The second line contains MM positive integers separated by spaces, which are the distinct random integers in ascending order.

10
20 40 32 67 40 20 89 300 400 15

8
15 20 32 40 67 89 300 400

Hint

NOIP 2006 Junior, Problem 1.

Translated by ChatGPT 5