eolymp
Problems

Move zeroes

Move zeroes

Sequence of integers is given. Rearrange all 0's to the end of it while maintaining the relative order of non-zero elements.

Input

First line contains number of elements n (1n100) in the sequence. Second line contains n integers, not greater than 100 by absolute value.

Output

Print the sequence so that all its 0's are moved to the end, and the relative order of non-zero elements is not changed.

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