There is a school of magic where 109 students study, each student has a distinct number ID from 1 to 109. There is a teacher who teaches magic to children. The teacher knows n types of tricks that he wants to teach, but since the number of students are large, he teaches the ith trick to only a range of students whose number ID lie in the range [l,r] (l and r included). You couldnt take admission into the school but want to learn all the n tricks. To do so you ask a student who knows ith trick to teach you for some amount of money. Since you want to learn all the tricks and save money you want to select the minimum number of students you need to chose that will teach you all the tricks. Since there are multiple possible answers, print the lexicographically smallest answer.
Input
- First line contains n, the number of tricks the teacher knows.
- N lines follow, ith line contain 2 space seperated integers l and r, the range of students who are taught the ith trick.
Output
- In first line print the minimum number of students that you need to choose.
- In next line print the ID of each selected student space seperated. The answer should be lexicographically smallest
Constraints
- 1\(\leq\) n \(\leq\) 105
- 1\(\leq\) l \(\leq\) r \(\leq\) 109
No editorial available for this problem.