The Red Button

题意翻译

Piegirl找到了那个红色的按钮。你只有最后一次机会来改变这个不可避免的结局。 这个按钮下的线路有$n$个结点,编号$0\sim n-1$。为了使这个按钮停止工作,这$n$个结点必须按一定顺序拆毁。编号为$0$的结点必须第一个拆毁。在拆毁第$i$号结点后,你要么拆毁编号为$2i\ \bmod n$的结点,要么拆毁编号为$(2i+1)\ \bmod n$的结点。最后一个拆毁的是$0$号结点(它被拆毁两次,但其他结点只能拆毁一次)。 你的任务是找出这样的拆毁顺序并输出它,如果找不到,就输出$-1$。

题目描述

Piegirl found the red button. You have one last chance to change the inevitable end. The circuit under the button consists of $ n $ nodes, numbered from 0 to $ n $ - 1. In order to deactivate the button, the $ n $ nodes must be disarmed in a particular order. Node 0 must be disarmed first. After disarming node $ i $ , the next node to be disarmed must be either node $ (2·i) $ modulo $ n $ or node $ (2·i)+1 $ modulo $ n $ . The last node to be disarmed must be node 0. Node 0 must be disarmed twice, but all other nodes must be disarmed exactly once. Your task is to find any such order and print it. If there is no such order, print -1.

输入输出格式

输入格式


Input consists of a single integer $ n $ ( $ 2<=n<=10^{5} $ ).

输出格式


Print an order in which you can to disarm all nodes. If it is impossible, print -1 instead. If there are multiple orders, print any one of them.

输入输出样例

输入样例 #1

2

输出样例 #1

0 1 0

输入样例 #2

3

输出样例 #2

-1

输入样例 #3

4

输出样例 #3

0 1 3 2 0

输入样例 #4

16

输出样例 #4

0 1 2 4 9 3 6 13 10 5 11 7 15 14 12 8 0