~/algor $ cat problems/massiv-oldingisidan-katta
Elements greater than the previous
Easy
1000 ms
128 MB
30%
A positive integer $n$ and an array of $n$ integers ($n \ge 2$) are given. Print the number of elements strictly greater than their previous neighbour, 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 such elements $k$. If $k \gt 0$, the second line contains these $k$ elements separated by spaces (if there are no such elements, only $0$ is printed).
Note
$2 \le n \le 1000$
$-10^{9} \le a_{i} \le 10^{9}$
Examples
Input #1
6 3 8 5 12 15 9
Output #1
3 8 12 15
Input #2
4 5 4 3 2
Output #2
0