#C10109. Remove Odds and Sort
Remove Odds and Sort
Remove Odds and Sort
Given a list of integers, your task is to remove all the odd elements from the list and output the remaining even numbers in sorted order. Specifically, you will be provided with an input where the first line contains an integer n representing the number of elements in the list, followed by a second line of n space-separated integers. Your job is to filter out the odd numbers, sort the remaining even numbers in non-decreasing order, and print the result on a single line with each number separated by a space.
If there are no even numbers, output an empty line.
Note: All formulas, if any, are displayed in LaTeX format. For example, the sorting condition can be represented as \(a \leq b\).
inputFormat
The first line of the input contains an integer \(n\) indicating the number of elements in the list. The second line contains \(n\) space-separated integers.
outputFormat
Output a single line containing the even numbers from the given list in sorted order (non-decreasing order). Each number should be separated by a single space. If there are no even numbers, output an empty line.
## sample11
3 1 4 1 5 9 2 6 5 3 5
2 4 6