func_code_string: #include <bits/stdc++.h>   using namespace std;   template <typename T>   inline bool upmin(T &x, T y) {     return y < x ? x = y, 1 : 0;   }   template <typename T>   inline bool upmax(T &x, T y) {     return x < y ? x = y, 1 : 0;   }   const long double eps = 1e-11;   const long double pi = acos(-1);   const int oo = 1 << 30;   const long long loo = 1ll << 62;   const int mods = 1e9 + 7;   const int MAXN = 1000005;   const int INF = 0x3f3f3f3f;   inline int read() {     int f = 1, x = 0;     char c = getchar();     while (c <  0  || c >  9 ) {       if (c ==  - ) f = -1;       c = getchar();     }     while (c >=  0  && c <=  9 ) {       x = (x << 3) + (x << 1) + (c ^ 48);       c = getchar();     }     return x * f;   }   int a[45], g[45], f[MAXN][45], id[MAXN];   int upd(int x, int y) { return x + y >= mods ? x + y - mods : x + y; }   signed main() {     int n = read(), m, flag = 0;     if (n == 2) {       puts( 1 );       return 0;     }     for (m = 0; 1 << m <= n; m++) a[m] = 1 << m;     m--;     if (a[m] * 3 / 2 <= n) {       flag = 1;       for (int i = 0; i < m; i++) a[m + i + 1] = a[i] * 3;       m = m + m;     }     sort(a, a + m + 1, [&](int x, int y) { return x > y; });     for (int i = 0; i <= m; i++) id[a[i]] = i;     for (int i = 0; i <= m; i++) g[i] = n / a[i];     f[1][0] = 1;     if (flag) f[1][1] = 1;     for (int i = 1; i < n; i++)       for (int j = 0; j < m; j++) {         f[i + 1][j] = upd(f[i + 1][j], 1ll * f[i][j] * max(g[j] - i, 0) % mods);         if (a[j] % 2 == 0)           f[i + 1][id[a[j] / 2]] =               upd(f[i + 1][id[a[j] / 2]],                   1ll * f[i][j] * max(g[id[a[j] / 2]] - g[j], 0) % mods);         if (a[j] % 3 == 0)           f[i + 1][id[a[j] / 3]] =               upd(f[i + 1][id[a[j] / 3]],                   1ll * f[i][j] * max(g[id[a[j] / 3]] - g[j], 0) % mods);       }     int ans = 0;     for (int i = n, fac = 1; i >= 1; i--)       ans = upd(ans, 1ll * fac * f[i][m] % mods),       fac = 1ll * fac * (n - i + 1) % mods;     printf( %d n , ans);     return 0;   }   