{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"The citizens of Bytetown, AB, could not stand that the candidates in the mayoral election campaign have been placing their electoral posters at all places at their whim. The city council has finally decided to build an electoral wall for placing the posters and introduce the following rules: \u003cbr\u003e\u003cul\u003e\u003cli\u003eEvery candidate can place exactly one poster on the wall. \u003cbr\u003e\u003c/li\u003e\u003cli\u003eAll posters are of the same height equal to the height of the wall; the width of a poster can be any integer number of bytes (byte is the unit of length in Bytetown). \u003cbr\u003e\u003c/li\u003e\u003cli\u003eThe wall is divided into segments and the width of each segment is one byte. \u003cbr\u003e\u003c/li\u003e\u003cli\u003eEach poster must completely cover a contiguous number of wall segments. \u003c/li\u003e\u003c/ul\u003e\u003cbr\u003eThey have built a wall 10000000 bytes long (such that there is enough place for all candidates). When the electoral campaign was restarted, the candidates were placing their posters on the wall and their posters differed widely in width. Moreover, the candidates started placing their posters on wall segments already occupied by other posters. Everyone in Bytetown was curious whose posters will be visible (entirely or in part) on the last day before elections. \u003cbr\u003eYour task is to find the number of visible posters when all the posters are placed given the information about posters\u0027 size, their place and order of placement on the electoral wall. \u003cbr\u003e"}},{"title":"Input","value":{"format":"HTML","content":"The first line of input contains a number c giving the number of cases that follow. The first line of data for a single case contains number 1 \u0026lt;\u003d n \u0026lt;\u003d 10000. The subsequent n lines describe the posters in the order in which they were placed. The i-th line among the n lines contains two integer numbers l\u003csub\u003ei\u003c/sub\u003e and ri which are the number of the wall segment occupied by the left end and the right end of the i-th poster, respectively. We know that for each 1 \u0026lt;\u003d i \u0026lt;\u003d n, 1 \u0026lt;\u003d l\u003csub\u003ei\u003c/sub\u003e \u0026lt;\u003d ri \u0026lt;\u003d 10000000. After the i-th poster is placed, it entirely covers all wall segments numbered l\u003csub\u003ei\u003c/sub\u003e, l\u003csub\u003ei\u003c/sub\u003e+1 ,... , ri. "}},{"title":"Output","value":{"format":"HTML","content":"For each input data set print the number of visible posters after all the posters are placed. \u003cbr\u003e\u003cbr\u003eThe picture below illustrates the case of the sample input.\u003cbr\u003e\u003cimg src\u003d\"CDN_BASE_URL/417e0d7743b599ac9db90a789c99b72b?v\u003d1726128978\"\u003e"}},{"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\u003e1\r\n5\r\n1 4\r\n2 6\r\n8 10\r\n3 4\r\n7 10\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"}}]}