func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, k;   int n1;   vector<long long> v;   int c[20];   int a[20];   bool viz[20];   int f[20];   inline void get(int i) {     int cif = 0;     long long zece = 1;     long long r = 0;     for (zece = 1; i > 0; i >>= 1, zece *= 10LL) {       ++cif;       if ((i & 1) != 0)         r += 7LL * zece;       else         r += 4LL * zece;     }     if (r != 0LL) v.push_back(r);     for (++cif; cif < 11; ++cif, zece *= 10LL) {       r += 4LL * zece;       v.push_back(r);     }   }   void back(int k1) {     if (k1 == n1 + 1) return;     for (int i = 1; i <= n1; ++i) {       if (viz[i]) continue;       if (k > f[n1 - k1])         k -= f[n1 - k1];       else {         viz[i] = true;         a[k1] = i;         back(k1 + 1);         return;       }     }     printf( -1 n );     exit(0);   }   int main() {     scanf( %d%d , &n, &k);     for (int i = 0; i < 1024; ++i) {       get(i);     }     sort(v.begin(), v.end());     int start = max(1, n - 12);     f[0] = f[1] = 1;     for (int i = 2; i < 13; ++i) f[i] = f[i - 1] * i;     n1 = n - start + 1;     back(1);     int rez = 0;     long long start1 = (long long)start;     for (size_t i = 0, lim = v.size(); i < lim && v[i] < start1; ++i) {       ++rez;     }     int x = start;     for (int i = 1; i <= n1; ++i, ++x) {       c[i] = x;     }     for (int i = 1; i <= n1; ++i) {       if (find(v.begin(), v.end(), (long long)(i - 1) + start1) != v.end() &&           find(v.begin(), v.end(), (long long)c[a[i]]) != v.end())         ++rez;     }     printf( %d n , rez);     return 0;   }   