e-olymp
Competitions

Arrays - 2

Remove Duplicates from Sorted Array

Given a sorted array, remove the duplicates such that each element appears only once. Implement a linear in time solution.

Input

First line contains the size n (1n100) of array. Second line gives n integers in sorted order, each number is no greater than 100 by absolute value.

Output

Print the sorted array with removed duplicates.

Time limit 1 second
Memory limit 128 MiB
Input example #1
9
-2 -2 0 1 1 2 4 4 5
Output example #1
-2 0 1 2 4 5
Input example #2
8
6 6 6 7 7 8 9 10
Output example #2
6 7 8 9 10