Since you are madly in love with Larry, you want to give him a present for his birthday. You know that Larry loves graphs and the number and decided that you will give him a present that will satisfy both of those desires. You have nodes, and want to construct an undirected simple graph for Larry that has properties:
- The minimum degree is
- Adding any edge that is not already part of the graph completes a cycle of length
- There is no cycle of length in the graph itself
Since edges are expensive, you want to find an undirected simple graph with the least number of edges that satisfies these properties. Can you make the perfect gift?
Input Specification
On the only line of input is one integer , the number of nodes you have.
Output Specification
The first line of output contains one integer , the number of edges you must use.
The next lines contain two integers and indicating that there is an edge connecting and .
Any optimal output will be accepted.
Subtasks
Subtask 1 (10%)
Subtask 2 (90%)
No further constraints.
Sample Input
6
Sample Output
9
1 4
1 5
1 6
2 4
2 5
2 6
3 4
3 5
3 6
Comments