{"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\"\u003eHere N (N ≥ 3) rabbits are playing by the river. They are playing on a number line, each occupying a different integer. In a single move, one of the outer rabbits jumps into a space between any other two. At no point may two rabbits occupy the same position.\u003cbr\u003eHelp them play as long as possible\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"The input has several test cases. The first line of input contains an integer t (1 ≤ t ≤ 500) indicating the number of test cases.\u003cbr\u003eFor each case the first line contains the integer N (3 ≤ N ≤ 500) described as above. The second line contains n integers $a_1$ \u0026lt; $a_2$ \u0026lt; $a_3$ \u0026lt; ... \u0026lt; $a_N$ which are the initial positions of the rabbits. For each rabbit, its initial position\u003cbr\u003e$a_i$ satisfies 1 ≤ $a_i$ ≤ 10000.\u003cbr\u003e"}},{"title":"Output","value":{"format":"HTML","content":"For each case, output the largest number of moves the rabbits can make.\u003cbr\u003e"}},{"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\u003e5\r\n3\r\n3 4 6\r\n3\r\n2 3 5\r\n3\r\n3 5 9\r\n4\r\n1 2 3 4\r\n4\r\n1 2 4 5\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1\r\n1\r\n3\r\n0\r\n1\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}