IOI '04 - Athens, Greece
The ancient mathematician and philosopher Pythagoras believed that
reality is mathematical in nature. Present-day biologists study
properties of biosequences. A biosequence is a sequence of
- contains each of the numbers
, - starts with
and ends with , and - has no two elements
, in adjacent positions in this order.
A subsequence consisting of adjacent elements of a biosequence is called a segment.
A segment of a biosequence is called a framed interval if it includes all integers whose values are between the value of the first element, which must be the smallest element in the segment, and the last element, which must be the largest and different from the first. A framed interval is called an empodio if it does not contain any shorter framed intervals.
As an example, consider the biosequence
You are to write a program that, given a biosequence, finds all empodia (plural for empodio) in that biosequence.
Input Specification
The first line contains a single integer
Output Specification
The first line of output is to contain one integer
Sample Input
8
0
3
5
4
6
2
1
7
Sample Output
1
2 5
Constraints
In one input,
Comments