eolymp
bolt
Try our new interface for solving problems
Problems

Flags for Provinces

Flags for Provinces

he government of Cuckooland decided that each province of such a huge country should have its own flag. A famous painter Cuckooshkin was told to create all flags. It is known that Cuckooshkin uses only n different colors in his paintings. According to the government's plan, every two flags of provinces should have at least one common color, which will symbolize integrity of the country. On the other hand, the painter wants to make these flags as varicolored as possible, so he doesn't want any color to occur in three or more flags.

What is the maximal number of flags Cuckooshkin can create without breaking neither his own nor government's requirements?

Input

The first line contains the only integer n (3n1000), the number of colors the painter can use. The colors are numbered 1 to n.

Output

In the first line output the maximal number k of flags the painter can create. Each of the next k lines should contain description of the next flag: first, the number of colors used in it and then the numbers of these colors. All integers in this line should be separated by single space. In case there are many correct answers, you can output any of them.

Time limit 1 second
Memory limit 128 MiB
Input example #1
4
Output example #1
3
2 1 2
2 3 1
2 2 3
Author Igor Chevdar
Source 2009 Petrozavodsk Winter Session, Ural SU Contest, February 4, Problem D