LogiQuest

74. Sort 0s, 1s and 2s

EasyDutch National Flag

The array contains only 0, 1 and 2. Print it sorted. Try to do it in a single pass without a sorting function.

Input format

Line 1: n Line 2: n values

Output format

The sorted array.

Example 1

Input

6
2 0 2 1 1 0

Output

0 0 1 1 2 2

Example 2

Input

3
2 1 0

Output

0 1 2

Constraints

1 ≤ n ≤ 10⁵

Read input from standard input and print the answer to standard output. Your code is judged against 6 test cases, most of them hidden.

Loading the MyLoginn IDE…