#P4161. [SCOI2009] 游戏

[SCOI2009] 游戏

Description

windy has learned a game.

For the NN numbers from 11 to NN, each number is mapped to a unique and different number from 11 to NN (i.e., a permutation).

At the beginning, windy writes the numbers in order 1,2,3,,N1, 2, 3, \cdots, N in a row on paper.

Then, underneath this row, he writes their corresponding numbers.

Next, underneath the new row, he writes the numbers corresponding to that row.

He repeats this process until the sequence becomes 1,2,3,,N1, 2, 3, \cdots, N again.

For example: 1 2 3 4 5 61\ 2\ 3\ 4\ 5\ 6.

The correspondence is: 121\to 2, 232\to 3, 313\to 1, 454\to 5, 545\to 4, 666\to 6.

windy operates as follows: 1 2 3 4 5 6 2 3 1 5 4 6 3 1 2 4 5 6 1 2 3 5 4 6 2 3 1 4 5 6 3 1 2 5 4 6 1 2 3 4 5 6

At this point, we have several rows of permutations of 11 to NN; in the example there are 77 rows.

Now windy wants to know: over all possible correspondences, how many different possible numbers of rows are there.

Input Format

A single integer, NN.

Output Format

A single integer, the number of possible row counts.

3
3
10
16

Hint

For 30%30\% of the testdata, 1N101 \le N \le 10.

For 100%100\% of the testdata, 1N10001 \le N \le 1000.

Translated by ChatGPT 5