A turnstile writes each admitted badge number to a singly linked chain, and the chain is already sorted in non-decreasing order. Collapse runs of equal values so that each distinct value appears exactly once, preserving the ascending order, and print the resulting chain.
Input format
Line 1: an integer n, the number of nodes.
Line 2: n space-separated integers in non-decreasing order (empty line when n is 0).
Output format
Line 1: the number of nodes remaining after deduplication. Line 2: the remaining values in ascending order, space-separated (empty line if none).
Constraints
- 0 <= n <= 100000
- -1000000000 <= each value <= 1000000000
- The input values are given in non-decreasing order.