{"trustable":false,"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\u003eদুইটা নাম্বারের জিসিডি বের করতে দেয়া হল তোমাকে what we think about our life? people say we\u0027re not happy. But somehow, among us, some believe happiness is overrated\u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003en\u003c/i\u003e\u003c/span\u003e squad soldiers to line up on the parade ground.\u003c/p\u003e\n\u003cp\u003eBy the military charter the soldiers should stand in the order of non-increasing of their height. But as there\u0027s virtually no time to do that, the soldiers lined up in the arbitrary order. However, the general is rather short-sighted and he thinks that the soldiers lined up correctly if the first soldier in the line has the maximum height and the last soldier has the minimum height. Please note that the way other solders are positioned does not matter, including the case when there are several soldiers whose height is maximum or minimum. Only the heights of the \u003cspan class\u003d\"tex-font-style-bf\"\u003efirst\u003c/span\u003e and the \u003cspan class\u003d\"tex-font-style-bf\"\u003elast\u003c/span\u003e soldier are important.\u003c/p\u003e\n\u003cp\u003eFor example, the general considers the sequence of heights \u003cspan class\u003d\"tex-font-style-tt\"\u003e(4, 3, 4, 2, 1, 1)\u003c/span\u003e correct and the sequence \u003cspan class\u003d\"tex-font-style-tt\"\u003e(4, 3, 1, 2, 2)\u003c/span\u003e wrong.\u003c/p\u003e\n\u003cp\u003eWithin one second the colonel can swap any two neighboring soldiers. Help him count the minimum time needed to form a line-up which the general will consider correct.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThere\u0027s two line as inputs. The first line contains the only integer \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003en\u003c/i\u003e\u003c/span\u003e (\u003cspan class\u003d\"tex-span\"\u003e2 ≤ \u003ci\u003en\u003c/i\u003e ≤ 100\u003c/span\u003e) which represents the number of soldiers in the line. The second line contains integers \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003ea\u003c/i\u003e\u003csub class\u003d\"lower-index\"\u003e1\u003c/sub\u003e, \u003ci\u003ea\u003c/i\u003e\u003csub class\u003d\"lower-index\"\u003e2\u003c/sub\u003e, ..., \u003ci\u003ea\u003c/i\u003e\u003csub class\u003d\"lower-index\"\u003e\u003ci\u003en\u003c/i\u003e\u003c/sub\u003e\u003c/span\u003e (\u003cspan class\u003d\"tex-span\"\u003e1 ≤ \u003ci\u003ea\u003c/i\u003e\u003csub class\u003d\"lower-index\"\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e ≤ 100\u003c/span\u003e) the values of the soldiers\u0027 heights in the order of soldiers\u0027 heights\u0027 increasing in the order from the beginning of the line to its end. Point to be noted, The numbers are space-separated. Another thing Numbers \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003ea\u003c/i\u003e\u003csub class\u003d\"lower-index\"\u003e1\u003c/sub\u003e, \u003ci\u003ea\u003c/i\u003e\u003csub class\u003d\"lower-index\"\u003e2\u003c/sub\u003e, ..., \u003ci\u003ea\u003c/i\u003e\u003csub class\u003d\"lower-index\"\u003e\u003ci\u003en\u003c/i\u003e\u003c/sub\u003e\u003c/span\u003e are not necessarily different.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003ePrint the only integer — the minimum number of seconds the colonel will need to form a line-up the general will like.\u003c/p\u003e"}},{"title":"Sample 1","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\u003e4\n33 44 11 22\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e2\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Sample 2","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\u003e7\n10 10 58 31 63 40 76\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e10\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 sample the colonel will need to swap the first and second soldier and then the third and fourth soldier. That will take 2 seconds. The resulting position of the soldiers is \u003cspan class\u003d\"tex-font-style-tt\"\u003e(44, 33, 22, 11)\u003c/span\u003e.\u003c/p\u003e\n\u003cp\u003eIn the second sample the colonel may swap the soldiers in the following sequence:\u003c/p\u003e\n\u003col\u003e \n \u003cli\u003e \u003cspan class\u003d\"tex-font-style-tt\"\u003e(10, 10, 58, 31, 63, 40, 76)\u003c/span\u003e \u003c/li\u003e\n \u003cli\u003e \u003cspan class\u003d\"tex-font-style-tt\"\u003e(10, 58, 10, 31, 63, 40, 76)\u003c/span\u003e \u003c/li\u003e\n \u003cli\u003e \u003cspan class\u003d\"tex-font-style-tt\"\u003e(10, 58, 10, 31, 63, 76, 40)\u003c/span\u003e \u003c/li\u003e\n \u003cli\u003e \u003cspan class\u003d\"tex-font-style-tt\"\u003e(10, 58, 10, 31, 76, 63, 40)\u003c/span\u003e \u003c/li\u003e\n \u003cli\u003e \u003cspan class\u003d\"tex-font-style-tt\"\u003e(10, 58, 31, 10, 76, 63, 40)\u003c/span\u003e \u003c/li\u003e\n \u003cli\u003e \u003cspan class\u003d\"tex-font-style-tt\"\u003e(10, 58, 31, 76, 10, 63, 40)\u003c/span\u003e \u003c/li\u003e\n \u003cli\u003e \u003cspan class\u003d\"tex-font-style-tt\"\u003e(10, 58, 31, 76, 63, 10, 40)\u003c/span\u003e \u003c/li\u003e\n \u003cli\u003e \u003cspan class\u003d\"tex-font-style-tt\"\u003e(10, 58, 76, 31, 63, 10, 40)\u003c/span\u003e \u003c/li\u003e\n \u003cli\u003e \u003cspan class\u003d\"tex-font-style-tt\"\u003e(10, 76, 58, 31, 63, 10, 40)\u003c/span\u003e \u003c/li\u003e\n \u003cli\u003e \u003cspan class\u003d\"tex-font-style-tt\"\u003e(76, 10, 58, 31, 63, 10, 40)\u003c/span\u003e \u003c/li\u003e\n \u003cli\u003e \u003cspan class\u003d\"tex-font-style-tt\"\u003e(76, 10, 58, 31, 63, 40, 10)\u003c/span\u003e \u003c/li\u003e\n\u003c/ol\u003e"}}]}