LearnPy Hub
← Arena
EasyRating 900

Squeeze Duplicates

The array is sorted. Remove duplicates in place (two pointers) and print the number of distinct values and the values.

Input

n, then n sorted integers.

Output

Two lines.

Sample 1

Input
5
1 1 2 2 3
Output
3
1 2 3

Sample 2

Input
1
7
Output
1
7
solution.py
Output appears here
Squeeze Duplicates · Python Arena problem · LearnPy Hub