Skip to content
UPEEC

Move Zeros to the End

Easy#arrays#two-pointers· solved by 0 · time limit 2.0 s

Move all zeros to the end while keeping the order of the other elements.

Input

nn, then nn integers.

Output

The rearranged array.

Constraints

1≤n≤1051 \le n \le 10^5

Sample 1

Input

5
0 1 0 3 12

Output

1 3 12 0 0

Sign in or join free to run and submit your solution.