stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include <iostream>

using namespace std;

int main() {

    int a,b;

    cin>>a>>b;

    if(a==b) {

        cout<<"Draw";

    }

    else if(a==1){

        cout<<"Alice";

    }

    else if(b==1){

        cout<<"Bob";

    }

    else if(a>b){

        cout<<"Alice";

    }

    else{

        cout<<"Bob";

    }

    system("pause");

}


// Faster C++ solution for the same problem (measured speedup: 5.309283571686823x):
#include <cstdio>

using namespace std;

int main ()

{

    int a,b;

    scanf("%d %d",&a,&b);

    if(a==b)

        printf("Draw\n");



    else if(a<b)

    {

        if(a==1)

        {

            printf("Alice\n");

        }

        else

            printf("Bob\n");

    }

    else if(a>b)

    {

        if(b==1)

            printf("Bob\n");

        else

            printf("Alice\n");

    }



    return 0;

}
// Slower C++ solution:
#include <iostream>

using namespace std;



int main(){

	int A ,B;

	cin >>A >> B;

	if (A>B && B!=1 || A<B && A==1)

		cout << "Alice";

	else if (B>A && A!=1 ||B<A && B==1)

		cout << "Bob";

	else 

		cout << "Draw";

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.291006313386459x):
#include <cstdio>

using namespace std;

int main ()

{

    int a,b;

    scanf("%d %d",&a,&b);

    if(a==b)

        printf("Draw\n");



    else if(a<b)

    {

        if(a==1)

        {

            printf("Alice\n");

        }

        else

            printf("Bob\n");

    }

    else if(a>b)

    {

        if(b==1)

            printf("Bob\n");

        else

            printf("Alice\n");

    }



    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



int Bob, Alice, Draw, x ,y;



int main () {

    cin >> x >> y;

    if (x==y){

        cout << "Draw" << endl;

    }else if (y==1){

        cout << "Bob" << endl;

    }else if ((x>y)||(x==1)){

        cout << "Alice" << endl;

    }else if (x==1){

        cout << "Alice" << endl;

    }else{

        cout << "Bob" << endl;

}

}


// Faster C++ solution for the same problem (measured speedup: 5.2619173755948x):
#include <cstdio>

using namespace std;

int main ()

{

    int a,b;

    scanf("%d %d",&a,&b);

    if(a==b)

        printf("Draw\n");



    else if(a<b)

    {

        if(a==1)

        {

            printf("Alice\n");

        }

        else

            printf("Bob\n");

    }

    else if(a>b)

    {

        if(b==1)

            printf("Bob\n");

        else

            printf("Alice\n");

    }



    return 0;

}
// Slower C++ solution:


#include<bits/stdc++.h>

#define lln long long int

#define llu unsigned lln

#define sc(n) scanf("%d",&n);

#define scl(n) scanf("%lld",&n);

#define scd(n) scanf("%lf",&n);

#define pf(res) printf("%d\n",res);

#define pfl(res) printf("%lld\n",res);

#define pfd(res) printf("%lf\n",res);

#define maxii 100005

using namespace std;

typedef pair<int,int> pii;

typedef pair<lln,lln> pll;

vector<int> vi[maxii];

vector<int>:: iterator child;

typedef vector<lln> vl;

typedef vector<pii> vii;

typedef vector<pll> vll;





int arr[maxii];

int arr2[maxii];

bool check[maxii];

int cnt=0,n;

void dfs(int node)

{

    check[node]=true;

    if(vi[node].size()==n-1)cnt++;

    for(int child=0;child<vi[node].size();child++)

    {

        if(check[vi[node][child]]==false)

        {

            dfs(vi[node][child]);

        }

    }

}



int main()

{

    int a,b;

    cin>>a>>b;

    if(a==1)a=14;

    if(b==1)b=14;

    if(a==b)cout<<"Draw";

    else if(a>b)cout<<"Alice";

    else cout<<"Bob";



}










// Faster C++ solution for the same problem (measured speedup: 3.536277817843456x):
#include <iostream>



using namespace std;



int main(){

    int a,b;

    cin >> a >> b;

    if ( a == b)

        cout << "Draw" << endl;

    else if (a == 1)

        cout << "Alice" << endl;

    else if (b == 1)

        cout << "Bob" << endl;

    else if (a >  b)

        cout << "Alice" <<  endl;

    else if ( b > a )

        cout << "Bob" << endl;



}
// Slower C++ solution:


#include<bits/stdc++.h>

#define lln long long int

#define llu unsigned lln

#define sc(n) scanf("%d",&n);

#define scl(n) scanf("%lld",&n);

#define scd(n) scanf("%lf",&n);

#define pf(res) printf("%d\n",res);

#define pfl(res) printf("%lld\n",res);

#define pfd(res) printf("%lf\n",res);

#define maxii 100005

using namespace std;

typedef pair<int,int> pii;

typedef pair<lln,lln> pll;

vector<int> vi[maxii];

vector<int>:: iterator child;

typedef vector<lln> vl;

typedef vector<pii> vii;

typedef vector<pll> vll;





int arr[maxii];

int arr2[maxii];

bool check[maxii];

int cnt=0,n;

void dfs(int node)

{

    check[node]=true;

    if(vi[node].size()==n-1)cnt++;

    for(int child=0;child<vi[node].size();child++)

    {

        if(check[vi[node][child]]==false)

        {

            dfs(vi[node][child]);

        }

    }

}



int main()

{

    int a,b;

    cin>>a>>b;

    if(a==1)a=14;

    if(b==1)b=14;

    if(a==b)cout<<"Draw";

    else if(a>b)cout<<"Alice";

    else cout<<"Bob";



}










// Faster C++ solution for the same problem (measured speedup: 3.536254614133712x):
#include <bits/stdc++.h>



using namespace std;





bool prime (int n){



    for(int i=2;i*i<=n;i++){

        if(n%i==0)  return false;

    }



    return true;

}





int main() {



   int n,m;

   cin>>n>>m;



   if(n==m)cout<<"Draw"<<endl;

   else if(n==1)cout<<"Alice"<<endl;

   else if(m==1)cout<<"Bob"<<endl;

   else if (n>m)cout<<"Alice"<<endl;

   else cout<<"Bob"<<endl;



    return 0;

}
// Slower C++ solution:


#include<bits/stdc++.h>

#define lln long long int

#define llu unsigned lln

#define sc(n) scanf("%d",&n);

#define scl(n) scanf("%lld",&n);

#define scd(n) scanf("%lf",&n);

#define pf(res) printf("%d\n",res);

#define pfl(res) printf("%lld\n",res);

#define pfd(res) printf("%lf\n",res);

#define maxii 100005

using namespace std;

typedef pair<int,int> pii;

typedef pair<lln,lln> pll;

vector<int> vi[maxii];

vector<int>:: iterator child;

typedef vector<lln> vl;

typedef vector<pii> vii;

typedef vector<pll> vll;





int arr[maxii];

int arr2[maxii];

bool check[maxii];

int cnt=0,n;

void dfs(int node)

{

    check[node]=true;

    if(vi[node].size()==n-1)cnt++;

    for(int child=0;child<vi[node].size();child++)

    {

        if(check[vi[node][child]]==false)

        {

            dfs(vi[node][child]);

        }

    }

}



int main()

{

    int a,b;

    cin>>a>>b;

    if(a==1)a=14;

    if(b==1)b=14;

    if(a==b)cout<<"Draw";

    else if(a>b)cout<<"Alice";

    else cout<<"Bob";



}










// Faster C++ solution for the same problem (measured speedup: 3.545719354570179x):
#include <iostream>

using namespace std;



// Caleb Faith Adnaka XI105

int main() {



    int A,B;

    cin >> A >> B;

    

    if (A == B){

        cout << "Draw\n";

    }

    else if (A > B && B != 1 || A == 1){

        cout << "Alice\n";

    }

    else if (B > A && A != 1 || B == 1){

        cout << "Bob\n";

    }



}
// Slower C++ solution:


#include<bits/stdc++.h>

#define lln long long int

#define llu unsigned lln

#define sc(n) scanf("%d",&n);

#define scl(n) scanf("%lld",&n);

#define scd(n) scanf("%lf",&n);

#define pf(res) printf("%d\n",res);

#define pfl(res) printf("%lld\n",res);

#define pfd(res) printf("%lf\n",res);

#define maxii 100005

using namespace std;

typedef pair<int,int> pii;

typedef pair<lln,lln> pll;

vector<int> vi[maxii];

vector<int>:: iterator child;

typedef vector<lln> vl;

typedef vector<pii> vii;

typedef vector<pll> vll;





int arr[maxii];

int arr2[maxii];

bool check[maxii];

int cnt=0,n;

void dfs(int node)

{

    check[node]=true;

    if(vi[node].size()==n-1)cnt++;

    for(int child=0;child<vi[node].size();child++)

    {

        if(check[vi[node][child]]==false)

        {

            dfs(vi[node][child]);

        }

    }

}



int main()

{

    int a,b;

    cin>>a>>b;

    if(a==1)a=14;

    if(b==1)b=14;

    if(a==b)cout<<"Draw";

    else if(a>b)cout<<"Alice";

    else cout<<"Bob";



}










// Faster C++ solution for the same problem (measured speedup: 3.4892063659992174x):
#include<bits/stdc++.h>

using namespace std;

#define Fastread ios_base::sync_with_stdio(false);

int main()

{

    Fastread;

    cin.tie(NULL);

    int a,b;

    cin>>a>>b;

    if(a==b){

        cout<<"Draw"<<endl;

    }

    else if(a==1 || b==1){

        if(a==1){

            cout<<"Alice"<<endl;

        }

        else{

            cout<<"Bob"<<endl;

        }

    }

    else if(a > b){

        cout<<"Alice"<<endl;

    }

    else{

        cout<<"Bob"<<endl;

    }

    return 0;

}
// Slower C++ solution:


#include<bits/stdc++.h>

#define lln long long int

#define llu unsigned lln

#define sc(n) scanf("%d",&n);

#define scl(n) scanf("%lld",&n);

#define scd(n) scanf("%lf",&n);

#define pf(res) printf("%d\n",res);

#define pfl(res) printf("%lld\n",res);

#define pfd(res) printf("%lf\n",res);

#define maxii 100005

using namespace std;

typedef pair<int,int> pii;

typedef pair<lln,lln> pll;

vector<int> vi[maxii];

vector<int>:: iterator child;

typedef vector<lln> vl;

typedef vector<pii> vii;

typedef vector<pll> vll;





int arr[maxii];

int arr2[maxii];

bool check[maxii];

int cnt=0,n;

void dfs(int node)

{

    check[node]=true;

    if(vi[node].size()==n-1)cnt++;

    for(int child=0;child<vi[node].size();child++)

    {

        if(check[vi[node][child]]==false)

        {

            dfs(vi[node][child]);

        }

    }

}



int main()

{

    int a,b;

    cin>>a>>b;

    if(a==1)a=14;

    if(b==1)b=14;

    if(a==b)cout<<"Draw";

    else if(a>b)cout<<"Alice";

    else cout<<"Bob";



}










// Faster C++ solution for the same problem (measured speedup: 3.536482292267609x):
#include<bits/stdc++.h>

using namespace std;

int main(){

    int a,b;

    cin>>a>>b;

    if(a==b){

        cout<<"Draw"<<endl;

    }

    else{

        if(a==1 && b>a){

            cout<<"Alice"<<endl;

        }

        else if(b==1 && a>b){

            cout<<"Bob"<<endl;

        }

        else{

            if(a>b){

                cout<<"Alice"<<endl;

            }

            else if(b>a){

                cout<<"Bob"<<endl;

            }

        }

    }

    return 0;

}
// Slower C++ solution:


#include<bits/stdc++.h>

#define lln long long int

#define llu unsigned lln

#define sc(n) scanf("%d",&n);

#define scl(n) scanf("%lld",&n);

#define scd(n) scanf("%lf",&n);

#define pf(res) printf("%d\n",res);

#define pfl(res) printf("%lld\n",res);

#define pfd(res) printf("%lf\n",res);

#define maxii 100005

using namespace std;

typedef pair<int,int> pii;

typedef pair<lln,lln> pll;

vector<int> vi[maxii];

vector<int>:: iterator child;

typedef vector<lln> vl;

typedef vector<pii> vii;

typedef vector<pll> vll;





int arr[maxii];

int arr2[maxii];

bool check[maxii];

int cnt=0,n;

void dfs(int node)

{

    check[node]=true;

    if(vi[node].size()==n-1)cnt++;

    for(int child=0;child<vi[node].size();child++)

    {

        if(check[vi[node][child]]==false)

        {

            dfs(vi[node][child]);

        }

    }

}



int main()

{

    int a,b;

    cin>>a>>b;

    if(a==1)a=14;

    if(b==1)b=14;

    if(a==b)cout<<"Draw";

    else if(a>b)cout<<"Alice";

    else cout<<"Bob";



}










// Faster C++ solution for the same problem (measured speedup: 3.536554818972782x):
#include<bits/stdc++.h>

using namespace std;



int main(){



    int a,b;

    cin>>a>>b;



    if(a==1){

        a=14;

    }

    if(b==1){

        b=14;

    }

    if(a==b){

        cout<<"Draw"<<endl;

    }

    else if(a<b){

        cout<<"Bob"<<endl;

    }

    else{

        cout<<"Alice"<<endl;

    }



    return 0;

}
// Slower C++ solution:


#include<bits/stdc++.h>

#define lln long long int

#define llu unsigned lln

#define sc(n) scanf("%d",&n);

#define scl(n) scanf("%lld",&n);

#define scd(n) scanf("%lf",&n);

#define pf(res) printf("%d\n",res);

#define pfl(res) printf("%lld\n",res);

#define pfd(res) printf("%lf\n",res);

#define maxii 100005

using namespace std;

typedef pair<int,int> pii;

typedef pair<lln,lln> pll;

vector<int> vi[maxii];

vector<int>:: iterator child;

typedef vector<lln> vl;

typedef vector<pii> vii;

typedef vector<pll> vll;





int arr[maxii];

int arr2[maxii];

bool check[maxii];

int cnt=0,n;

void dfs(int node)

{

    check[node]=true;

    if(vi[node].size()==n-1)cnt++;

    for(int child=0;child<vi[node].size();child++)

    {

        if(check[vi[node][child]]==false)

        {

            dfs(vi[node][child]);

        }

    }

}



int main()

{

    int a,b;

    cin>>a>>b;

    if(a==1)a=14;

    if(b==1)b=14;

    if(a==b)cout<<"Draw";

    else if(a>b)cout<<"Alice";

    else cout<<"Bob";



}










// Faster C++ solution for the same problem (measured speedup: 3.5456726993205594x):
#include <iostream>



using namespace std;



int main()

{

    int A,B ; 

    cin >> A >> B ;

    if(A == 1 && B != 1 )

    {

        cout << "Alice";

        

    }

    else if (B == 1 && A != 1 )

    {

        cout << "Bob" ;

    }

    else if (A == B)

    {

        cout << "Draw" ;

    }

    else if (A > B && B != 1)

    {

        cout << "Alice" ;

    }   

    else if (B > A && A != 1)

    {

        cout << "Bob" ;

    }   

    return 0;

}
// Slower C++ solution:


#include<bits/stdc++.h>

#define lln long long int

#define llu unsigned lln

#define sc(n) scanf("%d",&n);

#define scl(n) scanf("%lld",&n);

#define scd(n) scanf("%lf",&n);

#define pf(res) printf("%d\n",res);

#define pfl(res) printf("%lld\n",res);

#define pfd(res) printf("%lf\n",res);

#define maxii 100005

using namespace std;

typedef pair<int,int> pii;

typedef pair<lln,lln> pll;

vector<int> vi[maxii];

vector<int>:: iterator child;

typedef vector<lln> vl;

typedef vector<pii> vii;

typedef vector<pll> vll;





int arr[maxii];

int arr2[maxii];

bool check[maxii];

int cnt=0,n;

void dfs(int node)

{

    check[node]=true;

    if(vi[node].size()==n-1)cnt++;

    for(int child=0;child<vi[node].size();child++)

    {

        if(check[vi[node][child]]==false)

        {

            dfs(vi[node][child]);

        }

    }

}



int main()

{

    int a,b;

    cin>>a>>b;

    if(a==1)a=14;

    if(b==1)b=14;

    if(a==b)cout<<"Draw";

    else if(a>b)cout<<"Alice";

    else cout<<"Bob";



}










// Faster C++ solution for the same problem (measured speedup: 3.5457296012693256x):
#include <iostream>



using namespace std;



int main()

{

    int A,B;

    cin>>A>>B;

    if(A==1)

    {

        if(B==1)

            cout<<"Draw";

        else cout<<"Alice";

    }

    else if(B==1)

    {

        if(A==1)

            cout<<"Draw";

        else cout<<"Bob";

    }

    else {

        if(A>B)

            cout<<"Alice";

        else if(B>A)

            cout<<"Bob";

        else cout<<"Draw";

    }

    return 0;

}
// Slower C++ solution:
#include<cstdio>

#include<cstring>

#include<iostream>

#include<map>

#include<cmath>

//#include<windows.h>

#include<algorithm>

#include<set>

const double eps = 1e-1;

using namespace std;

typedef long long ll;



int n,e[] = {3,5,7},len,ans,dig[12];

bool t[10];

char a[13];



void dfs(int d){

    if(d>len+1)return;

    if(d>3){

        int sum=0;

        int cnt=0;

        set<int>s;

        for(int i=1;i<d;i++){

            sum = sum*10+dig[i];

            s.insert(dig[i]);

        }

        if(s.size()==3&&sum<=n){

            ans++;

//            cout<<sum<<endl;

        }

        s.clear();

    }



    for(int i=0;i<3;i++){

            dig[d] = e[i];

            dfs(d+1);

    }

}

int main(){

    scanf("%d",&n);

    sprintf(a,"%d",n);



    len = strlen(a);

//    cout<<len<<endl;

    dfs(1);

    printf("%d\n",ans);

    return 0;

}

//Hello World Here I Come

//          0                 10

//        0 1 1                8

//      0 1 1 2 3              6

//    0 1 1 2 3 5 8            4

//  0 1 1 2 3 5 8 13 21        2

//0 1 1 2 3 5 8 13 21 34 55    0


// Faster C++ solution for the same problem (measured speedup: 11.536031550993169x):
/*#include<cstdio>

#include<iostream>

using namespace std;



bool judge(int x){

    int ans3 = 0,ans5 = 0,ans7 = 0,num=0;

    do{

       if(x % 10 == 3) ans3++;

       if(x % 10 == 5) ans5++;

       if(x % 10 == 7) ans7++;

       num++;

       x = x/10;



    }while(x != 0);

    if(ans3 > 0 && ans5 > 0 && ans7 > 0 && ans3+ans5+ans7 == num){

        return true;

    }else{

        return false;

    }

}



int main(){

    int t;

    cin>>t;

    int ans = 0;

    for(int i = 1;i <= t;){

        if(judge(i)){

            ans++;

            i+=18;

        }else{

            i++;

        }

    }

    cout<<ans;

}

*/

#include<cstdio>

int count = 0;

int t;



void DFS(long long x,bool three,bool five,bool seven){

    if(x > t) return;

        if(three && five && seven) count++;

    DFS(x*10+3,true,five,seven);

    DFS(x*10+5,three,true,seven);

    DFS(x*10+7,three,five,true);



}



int main(){

    scanf("%d",&t);

    DFS(0,false,false,false);

    printf("%d",count);

}
// Slower C++ solution:
#include<cstdio>

#include<cstring>

#include<iostream>

#include<map>

#include<cmath>

//#include<windows.h>

#include<algorithm>

#include<set>

const double eps = 1e-1;

using namespace std;

typedef long long ll;



int n,e[] = {3,5,7},len,ans,dig[12];

bool t[10];

char a[13];



void dfs(int d){

    if(d>len+1)return;

    if(d>3){

        int sum=0;

        int cnt=0;

        set<int>s;

        for(int i=1;i<d;i++){

            sum = sum*10+dig[i];

            s.insert(dig[i]);

        }

        if(s.size()==3&&sum<=n){

            ans++;

//            cout<<sum<<endl;

        }

        s.clear();

    }



    for(int i=0;i<3;i++){

            dig[d] = e[i];

            dfs(d+1);

    }

}

int main(){

    scanf("%d",&n);

    sprintf(a,"%d",n);



    len = strlen(a);

//    cout<<len<<endl;

    dfs(1);

    printf("%d\n",ans);

    return 0;

}

//Hello World Here I Come

//          0                 10

//        0 1 1                8

//      0 1 1 2 3              6

//    0 1 1 2 3 5 8            4

//  0 1 1 2 3 5 8 13 21        2

//0 1 1 2 3 5 8 13 21 34 55    0


// Faster C++ solution for the same problem (measured speedup: 11.612344423381433x):
#include<stdio.h>



long long N;

int num;



void DFS(long long nown,unsigned int flag){

	if(nown<=N){

		if(flag==7) num++;

		DFS(nown*10+3,flag|1);

		DFS(nown*10+5,flag|2);

		DFS(nown*10+7,flag|4);

	}

}



int main(){

	while(scanf("%d",&N)==1){

		num=0;

		DFS(0,0);

		printf("%d\n",num);

	}

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

int num,res;



//ac是这些数字排列成的数字

//cnt表示已经有多少位置了



bool ok(long long n)

{

    int ret = 0;

    int cur;

    while(n)

    {

        cur = n%10;

        n /= 10;

        if(cur == 3) ret |= 1;

        else if(cur == 5) ret |= 2;

        else if(cur == 7) ret |= 4;

    }

    return ret == 7;

}



void dfs(long long ac)

{

    if(ac > num) return;

    else

    {

        if(ok(ac))

            ++res;

    }

    dfs(ac*10+3);

    dfs(ac*10+5);

    dfs(ac*10+7);

}



int main()

{

    scanf("%d",&num);

    res = 0;

    dfs(0);

    printf("%d\n",res);

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.803533611155777x):
#include<stdio.h>



long long N;

int num;



void DFS(long long nown,unsigned int flag){

	if(nown<=N){

		if(flag==7) num++;

		DFS(nown*10+3,flag|1);

		DFS(nown*10+5,flag|2);

		DFS(nown*10+7,flag|4);

	}

}



int main(){

	while(scanf("%d",&N)==1){

		num=0;

		DFS(0,0);

		printf("%d\n",num);

	}

	return 0;

}
// Slower C++ solution:
#include<cstdio>

#include<cstring>

#include<iostream>

#include<map>

#include<cmath>

//#include<windows.h>

#include<algorithm>

#include<set>

const double eps = 1e-1;

using namespace std;

typedef long long ll;



int n,e[] = {3,5,7},len,ans,dig[12];

bool t[10];

char a[13];



void dfs(int d){

    if(d>len+1)return;

    if(d>3){

        int sum=0;

        int cnt=0;

        set<int>s;

        for(int i=1;i<d;i++){

            sum = sum*10+dig[i];

            s.insert(dig[i]);

        }

        if(s.size()==3&&sum<=n){

            ans++;

//            cout<<sum<<endl;

        }

        s.clear();

    }



    for(int i=0;i<3;i++){

            dig[d] = e[i];

            dfs(d+1);

    }

}

int main(){

    scanf("%d",&n);

    sprintf(a,"%d",n);



    len = strlen(a);

//    cout<<len<<endl;

    dfs(1);

    printf("%d\n",ans);

    return 0;

}

//Hello World Here I Come

//          0                 10

//        0 1 1                8

//      0 1 1 2 3              6

//    0 1 1 2 3 5 8            4

//  0 1 1 2 3 5 8 13 21        2

//0 1 1 2 3 5 8 13 21 34 55    0


// Faster C++ solution for the same problem (measured speedup: 11.429257946811676x):
#include <stdio.h>

int count1=0;

int num;

void xiandan(long long n,unsigned char flag)

{

    if(n<=num)

    {

        if(flag==07)



        count1++;



            xiandan(n*10+3,flag|01);

            xiandan(n*10+5,flag|02);

            xiandan(n*10+7,flag|04);









    }



}

int main()

{

    scanf("%d",&num);

    xiandan(0,0);

    printf("%d",count1);

    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

int num,res;



//ac是这些数字排列成的数字

//cnt表示已经有多少位置了



bool ok(long long n)

{

    int ret = 0;

    int cur;

    while(n)

    {

        cur = n%10;

        n /= 10;

        if(cur == 3) ret |= 1;

        else if(cur == 5) ret |= 2;

        else if(cur == 7) ret |= 4;

    }

    return ret == 7;

}



void dfs(long long ac)

{

    if(ac > num) return;

    else

    {

        if(ok(ac))

            ++res;

    }

    dfs(ac*10+3);

    dfs(ac*10+5);

    dfs(ac*10+7);

}



int main()

{

    scanf("%d",&num);

    res = 0;

    dfs(0);

    printf("%d\n",res);

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.712031974468078x):
#include <stdio.h>

int count1=0;

int num;

void xiandan(long long n,unsigned char flag)

{

    if(n<=num)

    {

        if(flag==07)



        count1++;



            xiandan(n*10+3,flag|01);

            xiandan(n*10+5,flag|02);

            xiandan(n*10+7,flag|04);









    }



}

int main()

{

    scanf("%d",&num);

    xiandan(0,0);

    printf("%d",count1);

    return 0;

}
// Slower C++ solution:
#include<iostream>

#include<string.h>

using namespace std;

int N,count=0;



void getNum(long long num,int flag){

	int baiwei = flag/100;

	int shiwei = flag/10%10;

	int gewei = flag%10;

	if(num<=N){

		if(baiwei&&shiwei&&gewei){

			count++;

		}

		int temp1=flag,temp2=flag,temp3=flag;

		if(baiwei==0){

			temp1+=100;

		}

		getNum(num*10+3,temp1);

		if(shiwei==0){

			temp2+=10;

		}

		getNum(num*10+5,temp2);

		if(gewei==0){

			temp3+=1;

		}

		getNum(num*10+7,temp3);

	}

}



int main(){

	scanf("%d",&N);

	getNum(0,0);

	printf("%d\n",count);

}

// Faster C++ solution for the same problem (measured speedup: 4.843325555443707x):
#include <stdio.h>

int count1=0;

int num;

void xiandan(long long n,unsigned char flag)

{

    if(n<=num)

    {

        if(flag==07)



        count1++;



            xiandan(n*10+3,flag|01);

            xiandan(n*10+5,flag|02);

            xiandan(n*10+7,flag|04);









    }



}

int main()

{

    scanf("%d",&num);

    xiandan(0,0);

    printf("%d",count1);

    return 0;

}