{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"An integer interval [a,b], a \u0026lt; b, is a set of all consecutive integers beginning with a and ending with b. \r\u003cbr\u003eWrite a program that: finds the minimal number of elements in a set containing at least two different integers from each interval."}},{"title":"Input","value":{"format":"HTML","content":"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. "}},{"title":"Output","value":{"format":"HTML","content":"Output the minimal number of elements in a set containing at least two different integers from each interval. "}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e4\r\n3 6\r\n2 4\r\n0 2\r\n4 7\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e4\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}