#include #define rep(i,n) for (int i=0; i < (n); i++) using namespace std; using ll = long long; int ctoi(char x){ return x - '0'; } int main(){ ios::sync_with_stdio(false); int N; cin>>N; if(N<10){ cout << 0 << endl; return 0; } ll ans = 0; ll t=10; // 2桁の特殊処理 while(t<100){ int a = t%10; int b = (t/10)%t; if((a+b)%3==0 && a%3!=0 && b%3!=0){ ans ++; } if(t==N) break; t++; } cerr << ans << endl; // n桁以上の処理 string s = to_string(N); cerr << s.size() << endl; int sum=1; for(int i=0; i