September Challenge 2017

Second Problem Minimum Good Permutation of September challenge - My all the test cases are passing locally and i have done thorough checking of my code but then also I am getting Wrong answer.Here is link to my code

https://ideone.com/3nVRfH

Please help…I am unable to find where its going wrong

Here-

Input
1
7
Your Output
2 1 4 5 6 7 3
Expected Output
2 1 4 3 6 7 5 

You messed up case when N is odd.

Ohh thanks I took the indecies starting from 0 . That’s why my solution gone wrong

//