#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; ll ans = 0; ll t=10; // 2桁の特殊処理 while(t<100){ int a = t%10; int b = (t/10)%t; if((a+b)%3==0){ ans ++; } if(t==N) break; t++; } if(N<100){ cout << ans << endl; return 0; } for(int i=100; i<=N; i++){ string s = to_string(i); bool flg=true; for(int j=0; j