~/algor $ cat problems/massiv-juft-elementlar-soni
Number of even elements
Easy
1000 ms
128 MB
27%
A positive integer $n$ and an array of $n$ integers are given. Print the number of array elements with even values and these elements themselves in input order.
Input
The first line contains a positive integer $n$. The second line contains $n$ integers separated by spaces.
Output
The first line contains one integer — the number of even elements $k$. If $k \gt 0$, the second line contains these $k$ even elements separated by spaces (if there are no even elements, only $0$ is printed).
Note
$1 \le n \le 1000$
$-10^{9} \le a_{i} \le 10^{9}$
Examples
Input #1
5 4 7 8 3 10
Output #1
3 4 8 10
Input #2
3 1 3 5
Output #2
0