{"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":"PLAIN","content":"Ashiq loves zigzak game.This is a game where you will be given an array and you can right-shift the array. To win you have to sort the array in non-descending order\nas fast as possible. Ashiq consumes 1s to do one operation."}},{"title":"Input","value":{"format":"PLAIN","content":"Input will contain an integer up to 10^5 which is the array size.\nAnd than a line consisting of array elements."}},{"title":"Output","value":{"format":"PLAIN","content":"Print minimum number of operation to do this or print -1 if it is impossible"}},{"title":"Examples","value":{"format":"PLAIN","content":"\nInput\n2\n2 1\n\nOutput\n1\n\nInput\n3\n1 3 2\n\nOutput\n-1\n\nInput\n2\n1 2\n\nOutput\n0"}}]}