{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv\u003e\n An integer interval [a,b], a \u0026lt; b, is a set of all consecutive integers beginning with a and ending with b.\n \u003cbr\u003e Write a program that: finds the minimal number of elements in a set containing at least two different integers from each interval.\n\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cdiv\u003e\n The first line of the input contains the number of intervals n, 1 \u0026lt;\u003d n \u0026lt;\u003d 10000. Each of the following n lines contains two integers a, b separated by a single space, 0 \u0026lt;\u003d a \u0026lt; b \u0026lt;\u003d 10000. They are the beginning and the end of an interval.\n\u003c/div\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cdiv\u003e\n Output the minimal number of elements in a set containing at least two different integers from each interval.\n\u003c/div\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre\u003e\r\n4\r\n3 6\r\n2 4\r\n0 2\r\n4 7\r\n\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre\u003e\r\n4\r\n\u003c/pre\u003e"}}]}