Patriotic Painting 1
All points of the real line are initially colored yellow, and you want to make it more colorful. painters are at your service! If you hire -th painter, he will paint all the real points in the segment with blue color (that is, for every real with , if was colored in blue, it will keep being blue, and if it was yellow, it will become blue).
You like blue color, and initially, you wanted to hire all painters, but then you decided to save up some money. If some subset of these painters would give the same result, why hire more and pay more?
So, you decided to hire as few painters as possible so that the result of their work would be the same as if you hired all painters, but there is an issue: you forgot which pair correspondent to which painter.
Find the smallest integer such that if you hire any distinct painters, the result of their work would be the same as if you hired all painters.
Here we mean that colorings of the real line are different if there exists a point which is colored in yellow in one of them and in blue in another.
Giriş verilənləri
The first line contains a single integer () — the number of segments.
The -th of the next lines contains integers (). What a pity that you don't remember which of these pairs corresponds to which painter...
Çıxış verilənləri
Output the smallest integer such that if you hire any distinct painters, the end result of their work would be the same as if you hired all painters. It's easy to see that such always exists and satisfies .
Nümunələr
Qeyd
In the first sample, there are two painters, one would paint segment in blue, and the other one would paint segment , together they would paint segments and in blue. It's easy to see that wouldn't work: if you chose a painter who would paint points in , point would remain yellow.
In the second sample, there are three painters, and all of them would paint the same segment , so if you hired all of them, only segment would be painted! What a waste of resources. is sufficient, as no matter what painter you hire, he would paint the same segment .
In the second sample, there are four painters, one of which would paint segment , another , another , and the last one . If you hired all of them, they would paint segment in blue. are not sufficient: if you hire only painters corresponding to segments , , only segment would be colored blue in the end, and point would remain yellow. It's easy to see that any subset of three painters would color all points from segment in blue, so the answer is .