{"trustable":true,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n div.illustration {\n float: right;\n padding-left: 20px;\n }\n div.illustration .illustration {\n width: 100%;\n border-radius: 4px;\n }\n pre {\n display: block;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n color: #333;\n word-break: break-all;\n word-wrap: break-word;\n }\n\u003c/style\u003e\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\[\u0027, right: \u0027\\\\]\u0027, display: true}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\n \u003cp\u003eDo you know what attracts almost any college student to\n participate in an event? Yes, free food. It doesn’t matter\n whether the event involves a long (sometimes boring) seminar.\n As long as free food is served for the event, then students\n will surely come.\u003c/p\u003e\n \u003cp\u003eSuppose there are \u003cspan class\u003d\"tex2jax_process\"\u003e$N$\u003c/span\u003e\n events to be held this year. The \u003cspan class\u003d\"tex2jax_process\"\u003e$i^\\textrm {th}$\u003c/span\u003e event is scheduled\n from day \u003cspan class\u003d\"tex2jax_process\"\u003e$s_ i$\u003c/span\u003e to day\n \u003cspan class\u003d\"tex2jax_process\"\u003e$t_ i$\u003c/span\u003e, and free food is\n served for that event every day from day \u003cspan class\u003d\"tex2jax_process\"\u003e$s_ i$\u003c/span\u003e to day \u003cspan class\u003d\"tex2jax_process\"\u003e$t_ i$\u003c/span\u003e (inclusive). Your task in this\n problem is to find out how many days there are in which free\n food is served by at least one event.\u003c/p\u003e\n \u003cp\u003eFor example, let there be \u003cspan class\u003d\"tex2jax_process\"\u003e$N \u003d\n 3$\u003c/span\u003e events. The first event is held from day \u003cspan class\u003d\"tex2jax_process\"\u003e$10$\u003c/span\u003e to \u003cspan class\u003d\"tex2jax_process\"\u003e$14$\u003c/span\u003e, the second event is held from\n day \u003cspan class\u003d\"tex2jax_process\"\u003e$13$\u003c/span\u003e to \u003cspan class\u003d\"tex2jax_process\"\u003e$17$\u003c/span\u003e, and the third event is held from\n day \u003cspan class\u003d\"tex2jax_process\"\u003e$25$\u003c/span\u003e to \u003cspan class\u003d\"tex2jax_process\"\u003e$26$\u003c/span\u003e. The days in which free food is\n served by at least one event are \u003cspan class\u003d\"tex2jax_process\"\u003e$10, 11, 12, 13, 14, 15, 16, 17, 25,\n 26$\u003c/span\u003e, for a total of \u003cspan class\u003d\"tex2jax_process\"\u003e$10$\u003c/span\u003e days. Note that both events serve\n free food on days \u003cspan class\u003d\"tex2jax_process\"\u003e$13$\u003c/span\u003e and\n \u003cspan class\u003d\"tex2jax_process\"\u003e$14$\u003c/span\u003e.\u003c/p\u003e\n \u003ch2\u003eInput\u003c/h2\u003e\n \u003cp\u003eThe first line contains an integer \u003cspan class\u003d\"tex2jax_process\"\u003e$N$\u003c/span\u003e (\u003cspan class\u003d\"tex2jax_process\"\u003e$1\n \\le N \\le 100$\u003c/span\u003e) denoting the number of events. Each of\n the next \u003cspan class\u003d\"tex2jax_process\"\u003e$N$\u003c/span\u003e lines\n contains two integers \u003cspan class\u003d\"tex2jax_process\"\u003e$s_\n i$\u003c/span\u003e and \u003cspan class\u003d\"tex2jax_process\"\u003e$t_ i$\u003c/span\u003e\n (\u003cspan class\u003d\"tex2jax_process\"\u003e$1 \\le s_ i \\le t_ i \\le\n 365$\u003c/span\u003e) denoting that the \u003cspan class\u003d\"tex2jax_process\"\u003e$i^\\textrm {th}$\u003c/span\u003e event will be held\n from \u003cspan class\u003d\"tex2jax_process\"\u003e$s_ i$\u003c/span\u003e to\n \u003cspan class\u003d\"tex2jax_process\"\u003e$t_ i$\u003c/span\u003e (inclusive), and\n free food is served for all of those days.\u003c/p\u003e\n \u003ch2\u003eOutput\u003c/h2\u003e\n \u003cp\u003eThe output contains an integer denoting the number of days\n in which free food is served by at least one event.\u003c/p\u003e\n \u003ch2\u003eSample 1\u003c/h2\u003e\u003cbody\u003e\u003ctable class\u003d\"vjudge_sample\"\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\n10 14\n13 17\n25 26\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e10\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/body\u003e\n \u003ch2\u003eSample 2\u003c/h2\u003e\u003cbody\u003e\u003ctable class\u003d\"vjudge_sample\"\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\u003e2\n1 365\n20 28\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e365\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/body\u003e\n \u003ch2\u003eSample 3\u003c/h2\u003e\u003cbody\u003e\u003ctable class\u003d\"vjudge_sample\"\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\n29 29\n48 48\n102 102\n94 94\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e4\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/body\u003e\n "}}]}