{"trustable":true,"sections":[{"title":"Background","value":{"format":"MD","content":"It\u0027s almost time for noip, and yyy is very nervous!"}},{"title":"Description","value":{"format":"MD","content":"Currently, there are $n$ competitions on various ojs, and the start and end times of each competition are known.\n\nyyy believes that the more competitions he participates in, the better he will do in noip (not true).\n\nSo, he wants to know the maximum number of competitions he can participate in.\n\nAs yyy is a newbie, he must finish one competition before starting another, and he cannot participate in $2$ or more competitions simultaneously."}},{"title":"Input","value":{"format":"MD","content":"The first line contains an integer $n$, followed by $n$ lines, each containing $2$ integers $a_{i},b_{i}\\ (a_{i}\u003cb_{i})$, representing the start and end times of the competitions."}},{"title":"Output","value":{"format":"MD","content":"An integer representing the maximum number of competitions to participate in."}},{"title":"Sample 1","value":{"format":"MD","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\n0 2\n2 4\n1 3\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e2\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}},{"title":"Hint","value":{"format":"MD","content":"- For $20\\%$ data, $n \\le 10$;\n- For $50\\%$ data, $n \\le 10^3$;\n- For $70\\%$ data, $n \\le 10^{5}$;\n- For $100\\%$ data, $1\\le n \\le 10^{6}$, $0 \\le a_{i} \u003c b_{i} \\le 10^6$."}}]}