{"trustable":true,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027$$$$$$\u0027, right: \u0027$$$$$$\u0027, display: true},\n {left: \u0027$$$\u0027, right: \u0027$$$\u0027, display: false},\n {left: \u0027$$\u0027, right: \u0027$$\u0027, display: true},\n {left: \u0027$\u0027, right: \u0027$\u0027, display: false}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eAlice has a cake, and she is going to cut it. She will perform the following operation $$$n-1$$$ times: choose a piece of the cake (initially, the cake is all one piece) with weight $$$w\\ge 2$$$ and cut it into two smaller pieces of weight $$$\\lfloor\\frac{w}{2}\\rfloor$$$ and $$$\\lceil\\frac{w}{2}\\rceil$$$ ($$$\\lfloor x \\rfloor$$$ and $$$\\lceil x \\rceil$$$ denote \u003ca href\u003d\"https://en.wikipedia.org/wiki/Floor_and_ceiling_functions\"\u003efloor and ceiling functions\u003c/a\u003e, respectively).\u003c/p\u003e\u003cp\u003eAfter cutting the cake in $$$n$$$ pieces, she will line up these $$$n$$$ pieces on a table in an arbitrary order. Let $$$a_i$$$ be the weight of the $$$i$$$-th piece in the line.\u003c/p\u003e\u003cp\u003eYou are given the array $$$a$$$. Determine whether there exists an initial weight and sequence of operations which results in $$$a$$$.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first line contains a single integer $$$t$$$ ($$$1 \\le t \\le 10^4$$$) — the number of test cases.\u003c/p\u003e\u003cp\u003eThe first line of each test case contains a single integer $$$n$$$ ($$$1 \\le n \\le 2 \\cdot 10^5$$$).\u003c/p\u003e\u003cp\u003eThe second line of each test case contains $$$n$$$ integers $$$a_1, a_2, \\ldots, a_n$$$ ($$$1 \\le a_i \\le 10^9$$$).\u003c/p\u003e\u003cp\u003eIt is guaranteed that the sum of $$$n$$$ for all test cases does not exceed $$$2 \\cdot 10^5$$$.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eFor each test case, print a single line: print \u003cspan class\u003d\"tex-font-style-tt\"\u003eYES\u003c/span\u003e if the array $$$a$$$ could have resulted from Alice\u0027s operations, otherwise print \u003cspan class\u003d\"tex-font-style-tt\"\u003eNO\u003c/span\u003e.\u003c/p\u003e\u003cp\u003eYou may print each letter in any case (for example, \u003cspan class\u003d\"tex-font-style-tt\"\u003eYES\u003c/span\u003e, \u003cspan class\u003d\"tex-font-style-tt\"\u003eYes\u003c/span\u003e, \u003cspan class\u003d\"tex-font-style-tt\"\u003eyes\u003c/span\u003e, \u003cspan class\u003d\"tex-font-style-tt\"\u003eyEs\u003c/span\u003e will all be recognized as positive answer).\u003c/p\u003e"}},{"title":"Examples","value":{"format":"HTML","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\u003e14\n1\n327\n2\n869 541\n2\n985214736 985214737\n3\n2 3 1\n3\n2 3 3\n6\n1 1 1 1 1 1\n6\n100 100 100 100 100 100\n8\n100 100 100 100 100 100 100 100\n8\n2 16 1 8 64 1 4 32\n10\n1 2 4 7 1 1 1 1 7 2\n10\n7 1 1 1 3 1 3 3 2 3\n10\n1 4 4 1 1 1 3 3 3 1\n10\n2 3 2 2 1 2 2 2 2 2\n4\n999999999 999999999 999999999 999999999\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eYES\nNO\nYES\nYES\nNO\nYES\nNO\nYES\nYES\nYES\nYES\nNO\nNO\nYES\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Note","value":{"format":"HTML","content":"\u003cp\u003eIn the first test case, it\u0027s possible to get the array $$$a$$$ by performing $$$0$$$ operations on a cake with weight $$$327$$$.\u003c/p\u003e\u003cp\u003eIn the second test case, it\u0027s not possible to get the array $$$a$$$.\u003c/p\u003e\u003cp\u003eIn the third test case, it\u0027s possible to get the array $$$a$$$ by performing $$$1$$$ operation on a cake with weight $$$1\\,970\\,429\\,473$$$: \u003c/p\u003e\u003cul\u003e \u003cli\u003e Cut it in half, so that the weights are $$$[985\\,214\\,736, 985\\,214\\,737]$$$. \u003c/li\u003e\u003c/ul\u003e Note that the starting weight can be greater than $$$10^9$$$.\u003cp\u003eIn the fourth test case, it\u0027s possible to get the array $$$a$$$ by performing $$$2$$$ operations on a cake with weight $$$6$$$:\u003c/p\u003e\u003cul\u003e \u003cli\u003e Cut it in half, so that the weights are $$$[3,3]$$$. \u003c/li\u003e\u003cli\u003e Cut one of the two pieces with weight $$$3$$$, so that the new weights are $$$[1, 2, 3]$$$ which is equivalent to $$$[2, 3, 1]$$$ up to reordering.\u003c/li\u003e\u003c/ul\u003e"}}]}