{"raw_statement":[{"iden":"problem statement","content":"We have a sequence $X$, which is initially empty.  \nTakahashi has performed the following operation for $i=1,2,\\ldots,N$ in this order.\n\n*   Append $l_i,l_i+1,\\ldots,r_i$ in this order to the end of $X$.\n\nFind the greatest length of a strictly increasing subsequence of the final $X$."},{"iden":"constraints","content":"*   $1 \\leq N \\leq 2 \\times 10^5$\n*   $1 \\leq l_i \\leq r_i \\leq 10^9$\n*   All values in the input are integers."},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$N$\n$l_1$ $r_1$\n$\\vdots$\n$l_{N}$ $r_{N}$"},{"iden":"sample input 1","content":"4\n1 1\n2 4\n10 11\n7 10"},{"iden":"sample output 1","content":"8\n\nThe final $X$ is $(1,2,3,4,10,11,7,8,9,10)$.  \nThe $1$\\-st, $2$\\-nd, $3$\\-rd, $4$\\-th, $7$\\-th, $8$\\-th, $9$\\-th, and $10$\\-th elements form a strictly increasing subsequence with the greatest length."},{"iden":"sample input 2","content":"4\n1 1\n1 1\n1 1\n1 1"},{"iden":"sample output 2","content":"1\n\nThe final $X$ is $(1,1,1,1)$."},{"iden":"sample input 3","content":"1\n1 1000000000"},{"iden":"sample output 3","content":"1000000000"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}