CodeForces - 877C

时间:2023-06-20 09:26:07

Slava plays his favorite game "Peace Lightning". Now he is flying a bomber on a very specific map.

Formally, map is a checkered field of size 1 × n, the cells of which are numbered from 1 to n, in each cell there can be one or several tanks. Slava doesn't know the number of tanks and their positions, because he flies very high, but he can drop a bomb in any cell. All tanks in this cell will be damaged.

If a tank takes damage for the first time, it instantly moves to one of the neighboring cells (a tank in the cell n can only move to the cell n - 1, a tank in the cell 1 can only move to the cell 2). If a tank takes damage for the second time, it's counted as destroyed and never moves again. The tanks move only when they are damaged for the first time, they do not move by themselves.

Help Slava to destroy all tanks using as few bombs as possible.

Input

The first line contains a single integer n (2 ≤ n ≤ 100 000) — the size of the map.

Output

In the first line print m — the minimum number of bombs Slava needs to destroy all tanks.

In the second line print m integers k1, k2, ..., km. The number ki means that the i-th bomb should be dropped at the cell ki.

If there are multiple answers, you can print any of them.

Examples

Input
2
Output
3
2 1 2
Input
3
Output
4
2 1 3 2 在一个1*N的格子里很多坦克,你从高空不知道哪些格子里有坦克,但仍然需要扔炸弹把坦克全都炸毁,坦克第一次被炸到后,一定会向前或者向后移一个格子(第一个格子里的坦克只会向后移一个格子,
最后一个格子里的坦克只会向前移一个格子),当坦克被第二次炸到的时候才会被炸毁,问你怎样炸,才能使耗费的炸弹最少。 不要一看到这种题就感到无从下手,它肯定是有规律的。 在偶数区间里的坦克移动一次后就都到了奇数区间里,奇数区间里的坦克移动一次后就又到了偶数区间里,于是一个大胆的想法就产生了,先偶数区间炸一遍,再奇数区间炸一遍,最后再偶数区间炸一遍。经验正后,可行。
 #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
#include<deque>
#include<map>
#include<iostream>
using namespace std;
typedef long long LL;
const double pi=acos(-1.0);
const double e=exp();
const int N = ; int main()
{
LL i,p,j,n;
LL ans=,x,y;
scanf("%lld",&n);
while()
{
ans=n;
for(i=; i<=n; i+=)
{
//if(i!=n)
ans++;
}
printf("%lld\n",ans);
if(n>=)
printf("");
for(i=; i<=n; i+=)
printf(" %lld",i);
for(i=; i<=n; i+=)
printf(" %lld",i);
for(i=; i<=n; i+=)
{ printf(" %lld",i);
}
putchar('\n');
break;
}
return ;
}