P8468 [AtCoder] AtCoder Grand Contest 044 - Name-Preserving Clubs
NOI
题目描述

There are N people (with different names) and K clubs. For each club you know the list of members (so you have K unordered lists). Each person can be a member of many clubs (and also 0 clubs) and two different clubs might have exactly the same members. The value of the number K is the minimum possible such that the following property can be true for at least one configuration of clubs. If every person changes her name (maintaining the property that all names are different) and you know the new K lists of members of the clubs (but you don't know which list corresponds to which club), you are sure that you would be able to match the old names with the new ones.

Count the number of such configurations of clubs (or say that there are more than 1000). Two configurations of clubs that can be obtained one from the other if the N people change their names are considered equal.

Formal statement: A club is a (possibly empty) subset of \${1,\dots, N$\}$1, 2,\dots, N). A$ configuration of clubs is an unordered collection of K clubs (not necessarily distinct). Given $a permutation \sigma(1), \dots, \sigma(N)$\${1,\dots, N$\} and a configuration of clubs L=\${C_1, C_2, \dots, C_K$\},$\sigma(L)$\${\sigma(C_1), \sigma(C_2), \dots, \sigma(C_K)$\} (if C$a club, \sigma(C)=$\${\sigma(x)$:$, x\in$C\}). A configuration of clubs L is name-preserving$\sigma\not=\tau$, it holds $\sigma(L)\not=\tau(L)$.

You have to count the number of name-preserving configurations of clubs with the minimum possible number of clubs (so K is minimum). Two configurations L_1, L_2 such that $L_2=\sigma(L_1) ($for some permutation $\sigma)$ are considered equal. If there are more than 1000 such configurations, print -1.

Constraints

  • $2 \le N \le 2\cdot10^{18}$

Input

The input is given from Standard Input in the format

N

Output

If ans is the number of configurations with the properties described in the statement, you should print on Standard Output

ans

If there are more than 1000 such configurations, print -1.

Examples

Input

2

Output

1

Input

3

Output

1

Input

4

Output

7

Input

13

Output

6

Input

26

Output

-1

Input

123456789123456789

Output

-1

输入格式

见题面

输出格式

见题面

样例输入
123456789123456789
样例输出
-1