{"trustable":false,"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":"\u003cscript type\u003d\u0027text/x-mathjax-config\u0027\u003eMathJax.Hub.Config({tex2jax: { inlineMath: [[\u0027$\u0027,\u0027$\u0027]] } }); \u003c/script\u003e\n\u003cscript type\u003d\u0027text/javascript\u0027 src\u003d\u0027https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\u0027\u003e\u003c/script\u003e\n\u003cscript type\u003d\u0027text/javascript\u0027\u003esetTimeout(function(){MathJax.Hub.Queue([\u0027Typeset\u0027, MathJax.Hub, \u0027left_view\u0027]);}, 2000);\u003c/script\u003e\n\u003cdiv class\u003d\"panel_content\"\u003e\nNervending is an ACMer.\n \u003cbr\u003e\n \u003cbr\u003e Yesterday, NE learnt an algorithm: Bubble sort. Bubble sort will compare each pair of adjacent items and swap them if they are in the wrong order. The process repeats until no swap is needed.\n \u003cbr\u003e\n \u003cbr\u003e Today,NE comes up with a new algorithm and names it Strange Sorting.\n \u003cbr\u003e\n \u003cbr\u003e There are many rounds in Strange Sorting. For each round, NE chooses a number, and keeps swapping it with its next number while the next number is less than it. For example, if the sequence is “1 4 3 2 5”, and NE chooses “4”, he will get “1 3 2 4 5” after this round. Strange Sorting is similar to Bubble sort, but it’s a randomized algorithm because NE will choose a random number at the beginning of each round. NE wants to know that, for a given sequence, how many rounds are needed to sort this sequence in the best situation. In other words, you should answer the minimal number of rounds needed to sort the sequence into ascending order. To simplify the problem, NE promises that the sequence is a permutation of 1, 2, . . . , N .\n\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"The first line contains only one integer T (T ≤ 200), which indicates the number of test cases. For each test case, the first line contains an integer N (1 ≤ N ≤ 10 \n\u003csup\u003e6\u003c/sup\u003e). \n\u003cbr\u003e \n\u003cbr\u003e The second line contains N integers a \n\u003csub\u003ei\u003c/sub\u003e (1 ≤ a \n\u003csub\u003ei\u003c/sub\u003e ≤ N ), denoting the sequence NE gives you. \n\u003cbr\u003e \n\u003cbr\u003e The sum of N in all test cases would not exceed 3 × 10 \n\u003csup\u003e6\u003c/sup\u003e."}},{"title":"Output","value":{"format":"HTML","content":"For each test case, output a single line “Case #x: y”, where x is the case number (starting from 1), y is the minimal number of rounds needed to sort the sequence."}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre\u003e2\n5\n5 4 3 2 1\n5\n5 1 2 3 4\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre\u003eCase #1: 4\nCase #2: 1\n\n\n \n \u003ci style\u003d\"font-size:1px\"\u003e \u003c/i\u003e\u003c/pre\u003e"}},{"title":"Hint","value":{"format":"HTML","content":"\u003cpre\u003eIn the second sample, we choose “5” so that after the first round, sequence becomes “1 2 3 4 5”, and the algorithm completes.\n\n \n \u003c/pre\u003e"}}]}