#include using namespace std; typedef long long ll; typedef long double ld; typedef pair P; typedef pair Pi; #define rep(i,n) for(ll i=0;i inline bool chmax(T &a, T b){if(a inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;} template ostream& operator<<(ostream& s,const complex& d) {return s<<"("< ostream& operator<<(ostream& s,const pair& d) {return s<<"("< ostream& operator<<(ostream& s, const vector& d){int len=d.size();rep(i,len){s< ostream& operator<<(ostream& s,const vector>& d){int len=d.size();rep(i,len){s< ostream& operator<<(ostream& s,const set& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;} template ostream& operator<<(ostream& s,const multiset& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;} template ostream& operator<<(ostream& s,const map& m){s<<"{"<>n; int D=to_string(n).size(); int ans=0; if(D==2){ for(int x=12;x<=n;x+=3){ string s=to_string(x); int d=s.size(); reverse(begin(s),end(s)); bool flag=true; rep(i,d)rep(j,d){ if(i>=j) continue; int now=int(s[i]-'0')+int(s[j]-'0'); if(now%3) flag=false; } if(flag){ ans++; cout<