{"trustable":true,"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\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027$$$$$$\u0027, right: \u0027$$$$$$\u0027, display: true},\n {left: \u0027$$$\u0027, right: \u0027$$$\u0027, display: false},\n {left: \u0027$$\u0027, right: \u0027$$\u0027, display: true},\n {left: \u0027$\u0027, right: \u0027$\u0027, display: false}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eHãy định nghĩa một hàm $$$f(p)$$$ trên một hoán vị $$$p$$$ như sau. Gọi $$$g_i$$$ là \u003ca href\u003d\"https://en.wikipedia.org/wiki/Greatest_common_divisor\"\u003eước chung lớn nhất (GCD)\u003c/a\u003e của các phần tử $$$p_1$$$, $$$p_2$$$, ..., $$$p_i$$$ (nói cách khác, đó là GCD của tiền tố có độ dài $$$i$$$). Sau đó, $$$f(p)$$$ là số lượng các phần tử \u003cspan class\u003d\"tex-font-style-bf\"\u003ekhác nhau\u003c/span\u003e trong số $$$g_1$$$, $$$g_2$$$, ..., $$$g_n$$$.\u003c/p\u003e\u003cp\u003eGọi $$$f_{max}(n)$$$ là giá trị lớn nhất của $$$f(p)$$$ trong tất cả các hoán vị $$$p$$$ của các số nguyên $$$1$$$, $$$2$$$, ..., $$$n$$$.\u003c/p\u003e\u003cp\u003eCho một số nguyên $$$n$$$, đếm số lượng hoán vị $$$p$$$ của các số nguyên $$$1$$$, $$$2$$$, ..., $$$n$$$, sao cho $$$f(p)$$$ bằng $$$f_{max}(n)$$$. Vì câu trả lời có thể lớn, hãy in phần dư của nó khi chia cho $$$1000\\,000\\,007 \u003d 10^9 + 7$$$.\u003c/p\u003e"}},{"title":"Nhập vào","value":{"format":"HTML","content":"\u003cp\u003eDòng duy nhất chứa số nguyên $$$n$$$ ($$$2 \\le n \\le 10^6$$$)\u0026nbsp;— độ dài của các hoán vị.\u003c/p\u003e"}},{"title":"Xuất ra","value":{"format":"HTML","content":"\u003cp\u003eDòng duy nhất nên chứa câu trả lời của bạn theo modulo $$$10^9+7$$$.\u003c/p\u003e"}},{"title":"Ví dụ","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"}},{"title":"","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"}},{"title":"","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"}},{"title":"Ghi chú","value":{"format":"HTML","content":"\u003cp\u003eXem xét ví dụ thứ hai: đây là các hoán vị có độ dài $$$3$$$:\u003c/p\u003e\u003cul\u003e \u003cli\u003e $$$[1,2,3]$$$, $$$f(p)\u003d1$$$. \u003c/li\u003e\u003cli\u003e $$$[1,3,2]$$$, $$$f(p)\u003d1$$$. \u003c/li\u003e\u003cli\u003e $$$[2,1,3]$$$, $$$f(p)\u003d2$$$. \u003c/li\u003e\u003cli\u003e $$$[2,3,1]$$$, $$$f(p)\u003d2$$$. \u003c/li\u003e\u003cli\u003e $$$[3,1,2]$$$, $$$f(p)\u003d2$$$. \u003c/li\u003e\u003cli\u003e $$$[3,2,1]$$$, $$$f(p)\u003d2$$$. \u003c/li\u003e\u003c/ul\u003e\u003cp\u003eGiá trị lớn nhất là $$$f_{max}(3) \u003d 2$$$, và có $$$4$$$ hoán vị $$$p$$$ sao cho $$$f(p)\u003d2$$$.\u003c/p\u003e"}}]}