#C12958. Move Zeros to End

    ID: 42442 Type: Default 1000ms 256MiB

Move Zeros to End

Move Zeros to End

You are given an array of integers. Your task is to move all zeros in the array to the end while preserving the relative order of the non-zero elements. Formally, given an integer \(n\) representing the number of elements and an array \(a_1, a_2, \dots, a_n\), rearrange the array so that all the zeros are shifted to the end without changing the order of the other elements.

Input is read from standard input and the output is written to standard output.

Example:

Input:
5
0 1 0 3 12

Output: 1 3 12 0 0

</p>

inputFormat

The first line contains an integer \(n\) (\(1 \le n \le 10^5\)) representing the number of elements in the array. The second line contains \(n\) space-separated integers. Each integer \(a_i\) satisfies \(|a_i| \le 10^9\).

outputFormat

Print the modified array with all non-zero elements in their original order followed by all zeros. The numbers should be output on one line separated by a single space.

## sample
5
0 1 0 3 12
1 3 12 0 0

</p>