{"raw_statement":[{"iden":"statement","content":"It can be shown that any positive integer _x_ can be uniquely represented as _x_ = 1 + 2 + 4 + ... + 2_k_ - 1 + _r_, where _k_ and _r_ are integers, _k_ ≥ 0, 0 < _r_ ≤ 2_k_. Let's call that representation prairie partition of _x_.\n\nFor example, the prairie partitions of 12, 17, 7 and 1 are:\n\n<center>12 = 1 + 2 + 4 + 5,17 = 1 + 2 + 4 + 8 + 2,\n\n7 = 1 + 2 + 4,\n\n1 = 1.\n\n</center>Alice took a sequence of positive integers (possibly with repeating elements), replaced every element with the sequence of summands in its prairie partition, arranged the resulting numbers in non-decreasing order and gave them to Borys. Now Borys wonders how many elements Alice's original sequence could contain. Find all possible options!"},{"iden":"input","content":"The first line contains a single integer _n_ (1 ≤ _n_ ≤ 105) — the number of numbers given from Alice to Borys.\n\nThe second line contains _n_ integers _a_1, _a_2, ..., _a__n_ (1 ≤ _a__i_ ≤ 1012; _a_1 ≤ _a_2 ≤ ... ≤ _a__n_) — the numbers given from Alice to Borys."},{"iden":"output","content":"Output, **in increasing order**, all possible values of _m_ such that there exists a sequence of positive integers of length _m_ such that if you replace every element with the summands in its prairie partition and arrange the resulting numbers in non-decreasing order, you will get the sequence given in the input.\n\nIf there are no such values of _m_, output a single integer _\\-1_."},{"iden":"examples","content":"Input\n\n8\n1 1 2 2 3 4 5 8\n\nOutput\n\n2 \n\nInput\n\n6\n1 1 1 2 2 2\n\nOutput\n\n2 3 \n\nInput\n\n5\n1 2 4 4 4\n\nOutput\n\n\\-1"},{"iden":"note","content":"In the first example, Alice could get the input sequence from \\[6, 20\\] as the original sequence.\n\nIn the second example, Alice's original sequence could be either \\[4, 5\\] or \\[3, 3, 3\\]."}],"translated_statement":[{"iden":"statement","content":"可以证明，任意正整数 $x$ 可以唯一表示为 $x = 1 + 2 + 4 + \\dots + 2^{k-1} + r$，其中 $k$ 和 $r$ 是整数，满足 $k \\geq 0$ 且 $0 < r \\leq 2^k$。我们将这种表示称为 $x$ 的 #cf_span(class=[tex-font-style-underline], body=[prairie partition])。\n\n例如，$12$、$17$、$7$ 和 $1$ 的 prairie partition 分别为：\n\n$17 = 1 + 2 + 4 + 8 + 2$，\n\n$7 = 1 + 2 + 4$，\n\n$1 = 1$。\n\nAlice 取了一个正整数序列（可能包含重复元素），将每个元素替换为其 prairie partition 中的加数，然后将得到的所有数字按非降序排列并交给 Borys。现在 Borys 想知道，Alice 原始序列可能包含多少个元素？请找出所有可能的取值！\n\n第一行包含一个整数 $n$（$1 \\leq n \\leq 10^5$）——Alice 交给 Borys 的数字个数。\n\n第二行包含 $n$ 个整数 $a_1, a_2, \\dots, a_n$（$1 \\leq a_i \\leq 10^{12}$；$a_1 \\leq a_2 \\leq \\dots \\leq a_n$）——Alice 交给 Borys 的数字。\n\n请按递增顺序输出所有可能的 $m$ 值，使得存在一个长度为 $m$ 的正整数序列，若将每个元素替换为其 prairie partition 的加数，并将结果按非降序排列，恰好得到输入的序列。\n\n若不存在这样的 $m$ 值，请输出单个整数 _-1_。\n\n在第一个示例中，Alice 可能从原始序列 $[6, 20]$ 得到输入序列。\n\n在第二个示例中，Alice 的原始序列可能是 $[4, 5]$ 或 $[3, 3, 3]$。"},{"iden":"input","content":"第一行包含一个整数 $n$（$1 \\leq n \\leq 10^5$）——Alice 交给 Borys 的数字个数。第二行包含 $n$ 个整数 $a_1, a_2, \\dots, a_n$（$1 \\leq a_i \\leq 10^{12}$；$a_1 \\leq a_2 \\leq \\dots \\leq a_n$）——Alice 交给 Borys 的数字。"},{"iden":"output","content":"请按递增顺序输出所有可能的 $m$ 值，使得存在一个长度为 $m$ 的正整数序列，若将每个元素替换为其 prairie partition 的加数，并将结果按非降序排列，恰好得到输入的序列。若不存在这样的 $m$ 值，请输出单个整数 _-1_。"},{"iden":"examples","content":"输入\n8\n1 1 2 2 3 4 5 8\n输出\n2\n\n输入\n6\n1 1 1 2 2 2\n输出\n2 3\n\n输入\n5\n1 2 4 4 4\n输出\n-1"},{"iden":"note","content":"在第一个示例中，Alice 可能从原始序列 $[6, 20]$ 得到输入序列。在第二个示例中，Alice 的原始序列可能是 $[4, 5]$ 或 $[3, 3, 3]$。"}],"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ x \\in \\mathbb{Z}^+ $. The *prairie partition* of $ x $ is the unique representation:  \n$$\nx = \\sum_{i=0}^{k-1} 2^i + r = (2^k - 1) + r, \\quad \\text{where } k \\in \\mathbb{Z}_{\\geq 0}, \\; r \\in \\{1, 2, \\dots, 2^k\\}.\n$$  \nThe summands in the prairie partition are: $ 1, 2, 4, \\dots, 2^{k-1}, r $ (in increasing order).\n\nLet $ P(x) $ denote the multiset of summands in the prairie partition of $ x $.\n\nGiven a multiset $ A = \\{a_1, a_2, \\dots, a_n\\} $ with $ a_1 \\leq a_2 \\leq \\dots \\leq a_n $, we say $ A $ is *realizable* if there exists a sequence $ X = (x_1, \\dots, x_m) $ of positive integers such that:  \n$$\nA = \\bigcup_{i=1}^m P(x_i) \\quad \\text{(as a multiset, sorted)}.\n$$\n\n**Constraints**  \n1. $ 1 \\leq n \\leq 10^5 $  \n2. $ 1 \\leq a_i \\leq 10^{12} $ for all $ i $  \n3. $ a_1 \\leq a_2 \\leq \\dots \\leq a_n $\n\n**Objective**  \nFind all integers $ m \\geq 1 $ such that there exists a sequence $ X $ of length $ m $ with $ A = \\bigcup_{i=1}^m P(x_i) $.  \nOutput all such $ m $ in increasing order. If none exist, output $-1$.","simple_statement":null,"has_page_source":false}