Codeforces Round 452 (Div. 2)
C
Dividing the numbers
Codeforces
1300
原题
← BD →
翻译中…

Petya has $*n*$ integers: $1, 2, 3, ..., *n*$. He wants to split these integers in two non-empty groups in such a way that the absolute difference of sums of integers in each group is as small as possible.

翻译中…

Help Petya to split the integers. Each of $*n*$ integers should be exactly in one group.

翻译中…

Input

翻译中…

The first line contains a single integer $*n*$ ($2 ≤ *n* ≤ 60 000$) — the number of integers Petya has.

翻译中…

Output

翻译中…

Print the smallest possible absolute difference in the first line.

翻译中…

In the second line print the size of the first group, followed by the integers in that group. You can print these integers in arbitrary order. If there are multiple answers, print any of them.

翻译中…

Note

翻译中…

In the first example you have to put integers $1$ and $4$ in the first group, and $2$ and $3$ in the second. This way the sum in each group is $5$, and the absolute difference is $0$.

翻译中…

In the second example there are only two integers, and since both groups should be non-empty, you have to put one integer in the first group and one in the second. This way the absolute difference of sums of integers in each group is $1$.

翻译中…

样例

Input #1
4
Output #1
0
2 1 4
InputCopy OutputCopy
Input #2
2
Output #2
1
1 1
InputCopy OutputCopy
题目信息
题号
899C
时间限制
1 s
内存限制
256 MB
标签
构造
图论
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。