{"trustable":false,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003e让我们在一个排列 $$$p$$$ 上定义一个函数 $$$f(p)$$$,如下所示。 让 $$$g_i$$$ 成为元素 $$$p_1$$$ , $$$p_2$$$, ..., $$$p_i$$$的\u003ca href\u003d\"https://en.wikipedia.org/wiki/Greatest_common_divisor\"\u003e最大公约数 (GCD)\u003c/a\u003e(换句话说,它是长度为 $$$i$$$ 的前缀的 GCD)。 那么 $$$f(p)$$$ 是 $$$g_1$$$, $$$g_2$$$ , ..., $$$g_n$$$中\u003cspan class\u003d\"tex-font-style-bf\"\u003e不同\u003c/span\u003e元素的数量 。\u003c/p\u003e\n\u003cp\u003e令 $$$f_{max}(n)$$$ 为 $$$f(p)$$$ 在所有排列中的最大值 $$$p$$$ 的整数 $$$1$$$ , $$$2$$$, ..., $$$n$$$。\u003c/p\u003e\n\u003cp\u003e给定一个整数 $$$n$$$,计算排列的数量 $$$p$$$ 的整数 $$$1$$$, $$$2$$$, ..., $$$n $$$,使得 $$$f(p)$$$ 等于 $$$f_{max}(n)$$$。 由于答案可能很大,将其除以 $$$1000\\,000\\,007 \u003d 10^9 + 7$$$ 打印出余数。\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003e唯一的一行包含整数 $$$n$$$ ($$$2 \\le n \\le 10^6$$$)\u0026nbsp;——排列的长度。\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003e唯一的一行应该包含你的答案模 $$$10^9+7$$$。\u003c/p\u003e"}},{"title":"Sample 1","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e2\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Sample 2","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e3\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e4\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Sample 3","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e6\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e120\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Note","value":{"format":"HTML","content":"\u003cp\u003e考虑第二个例子:这些是长度 $$$3$$$ 的排列:\u003c/p\u003e\n\u003cul\u003e\n \u003cli\u003e $$$[1,2,3]$$$, $$$f(p)\u003d1$$$。 \u003c/li\u003e\n \u003cli\u003e $$$[1,3,2]$$$, $$$f(p)\u003d1$$$。 \u003c/li\u003e\n \u003cli\u003e $$$[2,1,3]$$$, $$$f(p)\u003d2$$$。 \u003c/li\u003e\n \u003cli\u003e $$$[2,3,1]$$$, $$$f(p)\u003d2$$$。 \u003c/li\u003e\n \u003cli\u003e $$$[3,1,2]$$$, $$$f(p)\u003d2$$$。 \u003c/li\u003e\n \u003cli\u003e $$$[3,2,1]$$$, $$$f(p)\u003d2$$$。 \u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003e最大值 $$$f_{max}(3) \u003d 2$$$,并且有 $$$4$$$ 排列 $$$p$$$ 使得 $$$f(p)\u003d2$$$ 。\u003c/p\u003e"}}]}