eolymp
bolt
Try our new interface for solving problems
Problems

Airlines - 2

Airlines - 2

Oh! Bytelandavia, once the sole airline in Byteland, has gone bankrupt and now several new companies are after their contracts. Byteland's Civil Aviation Office (CAO) wants to minimize their number, but without hurting the established timetables. There are \textbf{N} airports in Byteland, and so far there have been direct flights in both directions between all pairs of them. The officials of the CAO want to preserve this situation, but for each pair of airports they want all flights between them be operated by a single company. The second requirement of the CAO is harder to understand, but it is mandatory none the less (they are not pushing their papers for nothing)... So, the requirement is that a traveler is not allowed to make a round trip (returning to his starting airport) using only planes of a single company if he makes intermediate stops in an even number of airports. For example, if he has to fly from New Vasiuky to Old Moscow, then to Vovinburg and then return to New Vasiuky, he will have to use at least two different companies. However, if he would also pass through New Bobruisk, there would be no such requirement. Determine the minimal number of airline companies needed to fulfill the requirements of the CAO. Find also one possible division of the flights between the new companies. \InputFile The only line of input contains \textbf{N} --- the number of airports in Byteland (\textbf{2}  ≤  \textbf{N}  ≤  \textbf{500}). \OutputFile The first line of output should contain \textbf{K}, the number of airline companies. \textbf{N-1} lines should follow. The \textbf{i}-th of these lines (\textbf{1} ≤ \textbf{i} ≤ \textbf{N-1}) should contain \textbf{N-i} integers. The \textbf{j}-th integer of the \textbf{i}-th line should denote the airline company that operates flights between the airports \textbf{i} and \textbf{i+j}. Both the companies and the airports are numbered starting from \textbf{1}.
Time limit 1 second
Memory limit 256 MiB
Input example #1
2
Output example #1
1
1
Source NEERC Western Subregional Contest 2012