{"trustable":true,"prependHtml":"\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"panel_content\"\u003e$\\textbf{Note:There is no dependency between this problem and problem Hack of Multiply 2 Divide 2.}$\u003cbr\u003e\u003cbr\u003eFrank_DD has a sequence $a$ of length $n$.\u003cbr\u003e\u003cbr\u003eFor each operation, he selects a number $a_i(1 \\le i \\le n)$ and changes it to $a_i\\cdot 2$ or $\\lfloor \\frac{a_i}{2} \\rfloor$.\u003cbr\u003e\u003cbr\u003eFrank_DD wants to know the minimum number of operations to change the sequence $a$ to a non-descending sequence.\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"The first line of the input contains one integer $T$ $($$1\\leq T\\leq 5$ $)$ --- the number of test cases. Then $T$ test cases follow.\u003cbr\u003e\u003cbr\u003eIn each test case:\u003cbr\u003e\u003cbr\u003eThe first line contains a single integer $n(1 \\leq n \\leq 10^5)$ --- the length of sequence $a$. \u003cbr\u003e\u003cbr\u003eThe second line contains $n$ integers $a_1, a_2, \\ldots, a_n$ $(1 \\leq a_i \\leq 10^5)$ --- the sequence $a$.\u003cbr\u003e"}},{"title":"Output","value":{"format":"HTML","content":"For each test case, print a single integer in a single line --- the minimum number of operations to change the sequence $a$ to a non-descending sequence."}},{"title":"Sample","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\u003e2\r\n7\r\n6 3 3 4 10 8 2\r\n10\r\n9 9 4 7 3 10 10 8 4 3\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e4\r\n11\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Hint","value":{"format":"HTML","content":"\u003cbr\u003eIn the first test case, we can use at least 4 operations to change the sequence $a$ to a non-descending sequence:\u003cbr\u003e\u003cbr\u003e$a_1\u003d\\lfloor \\frac{a_1}{2} \\rfloor$\u003cbr\u003e\u003cbr\u003e$a_5\u003d\\lfloor \\frac{a_5}{2} \\rfloor$\u003cbr\u003e\u003cbr\u003e$a_7\u003da_7 \\cdot 2$\u003cbr\u003e\u003cbr\u003e$a_7\u003da_7 \\cdot 2$\u003cbr\u003e "}}]}