ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules

1474. About Frogs

Time limit: 1.0 second
Memory limit: 64 MB
Once N white and N black frogs decided to play a game. They found 2N+1 tussocks and numbered them from 0 to 2N. Then the frogs occupied the tussocks in such a way that the white frogs sit on the tussocks with numbers 0 .. N–1, the black frogs sit on the tussocks with numbers N+1 .. 2N, and the tussock N is empty. The goal is to swap the white and black frogs, i.e., in the end of the game the first N tussocks must be occupied by the black frogs, and the last N tussocks must be occupied by the white frogs. In this game, the following moves are allowed. Frogs may jump only to empty tussocks. A black frog may jump from a tussock numbered i > 0 to the tussock i–1, or it may jump from a tussock j > 1 to the tussock j–2 if there is a white frog on the tussock j–1. Similarly, a white frog may jump from a tussock i < 2N to the tussock i+1, or it may jump from a tussock j < 2N-1 to the tussock j+2 if there is a black frog on the tussock j+1. Usually in games white and black make moves by turns, but here white and black frogs have the same goal, so they may make moves in any order, and the total number of moves of white frogs may differ from the total number of moves of black frogs. If after one million moves the frogs still have not swapped, they become bored of the game and jump into the water.
Given N, determine if the frogs can achieve their goal.

Input

The input is a single integer N in the range from 1 to 499.

Output

If the frogs cannot swap, then output the number –1. Otherwise, in the first line output the number of moves K needed for the fulfillment of the task, and in the second line output the sequence of numbers Сi separated by a space (1 ≤ iK), where Сi is the number of the tussock from which a jump is performed at the ith move. If there are many solutions, you may output any of them.

Sample

inputoutput
1
3
2 0 1
Problem Author: Alexander Ipatov
Problem Source: Ural SU and Orel STU Contest. Petrozavodsk Summer Session, August 2006