Move zeros to the end

Move every 0 in the array to the end, keeping the other numbers in their original order.

Reported in: HCLTech, Deloitte (memory-based)

Input

First line: N. Second line: N integers.

Output

The new array, space-separated.

Constraints

1 ≤ N ≤ 10^5.

Example 1

Input:
6
0 1 0 3 12 0

Output:
1 3 12 0 0 0

Example 2

Input:
3
0 0 5

Output:
5 0 0

Hint: Copy non-zero values forward with a write pointer, then fill the rest with zeros.

All coding practice