{"raw_statement":[{"iden":"statement","content":"Pavel is developing a game. To do that, he needs functions available in a third-party library too famous to be called. It is known that the function i first appeared in version ai and existed until version bi, and starting from the version bi + 1, it is absent in this library.\n\nThe library is not free and Pavel needs all the functions. Which minimal number of versions he need to purchase to be able to use all the functions?\n\nThe first line contains a single integer n (1 ≤ n ≤ 200000) — the number of the functions.\n\nEach of the next n lines contains two integers ai and bi (1 ≤ ai ≤ bi ≤ 109) — the interval of library versions where function i was available.\n\nIn the first line output a single integer k — the minimal number of library versions need to be purchased to unlock all functions.\n\nIn the second line output k distinct integers — the numbers of versions need to be purchased.\n\nIf there are several possible answers, output any of them.\n\n"},{"iden":"input","content":"The first line contains a single integer n (1 ≤ n ≤ 200000) — the number of the functions.Each of the next n lines contains two integers ai and bi (1 ≤ ai ≤ bi ≤ 109) — the interval of library versions where function i was available."},{"iden":"output","content":"In the first line output a single integer k — the minimal number of library versions need to be purchased to unlock all functions.In the second line output k distinct integers — the numbers of versions need to be purchased.If there are several possible answers, output any of them."}],"translated_statement":null,"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ n \\in \\mathbb{Z}^+ $ be the number of functions.  \nFor each $ i \\in \\{1, \\dots, n\\} $, let $ [a_i, b_i] \\subseteq \\mathbb{Z} $ be the interval of versions where function $ i $ is available, with $ 1 \\leq a_i \\leq b_i \\leq 10^9 $.\n\n**Constraints**  \n1. $ 1 \\leq n \\leq 200000 $  \n2. For all $ i \\in \\{1, \\dots, n\\} $: $ 1 \\leq a_i \\leq b_i \\leq 10^9 $\n\n**Objective**  \nFind the minimal cardinality set $ S \\subseteq \\mathbb{Z} $ such that for every $ i \\in \\{1, \\dots, n\\} $, there exists $ s \\in S $ with $ s \\in [a_i, b_i] $.  \nOutput $ |S| $ and any such set $ S $.","simple_statement":"You are given n functions, each available in a range of versions [a_i, b_i].  \nFind the minimum number of versions to buy so that every function is available in at least one bought version.  \nOutput the count and the list of chosen versions.","has_page_source":false}