{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eThere\u0027s a beach in the first quadrant. And from time to time, there are sea waves. A wave ( $x$ , $y$ ) means the wave is a rectangle whose vertexes are ( $0$ , $0$ ), ( $x$ , $0$ ), ( $0$ , $y$ ), ( $x$ , $y$ ). Every time the wave will wash out the trace of former wave in its range and remain its own trace of ( $x$ , $0$ ) -\u0026gt; ( $x$ , $y$ ) and ( $0$ , $y$ ) -\u0026gt; ( $x$ , $y$ ). Now the toad on the coast wants to know the total length of trace on the coast after n waves. It\u0027s guaranteed that a wave will not cover the other completely.\u003c/p\u003e\u003ch3\u003eInput\u003c/h3\u003e\u003cp\u003eThe first line is the number of waves $n(n \\le 50000)$.\u003c/p\u003e\u003cp\u003eThe next $n$ lines,each contains two numbers $x$ $y$ ,( $0 \u0026lt; x$ , $y \\le 10000000$ ),the $i$-th line means the $i$-th second there comes a wave of ( $x$ , $y$ ), it\u0027s guaranteed that when $1 \\le i$ , $j \\le n$ ,$x_i \\le x_j$ and $y_i \\le y_j$ don\u0027t set up at the same time.\u003c/p\u003e\u003ch3\u003eOutput\u003c/h3\u003e\u003cp\u003eAn Integer stands for the answer.\u003c/p\u003e\u003ch3\u003eHint:\u003c/h3\u003e\u003cp\u003eAs for the sample input, the answer is $3+3+1+1+1+1\u003d10$\u003c/p\u003e\u003cp\u003e\u003cimg src\u003d\"CDN_BASE_URL/2839eb9f25b3ef97e377c41c14634c13?v\u003d1713912216\" alt\u003d\"\"\u003e\u003c/p\u003e"}},{"title":"Sample 1","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\u003e3\n1 4\n4 1\n3 3\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e10\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003cbr /\u003e"}}]}