#include using namespace std; using ll = long long; #define int ll using VI = vector; using VVI = vector; using PII = pair; #define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i) #define REP(i, n) FOR(i, 0, n) #define ALL(x) x.begin(), x.end() #define PB push_back const ll LLINF = (1LL<<60); const int INF = (1LL<<30); const int MOD = 1000000007; template T &chmin(T &a, const T &b) { return a = min(a, b); } template T &chmax(T &a, const T &b) { return a = max(a, b); } template bool IN(T a, T b, T x) { return a<=x&&x T ceil(T a, T b) { return a/b + !!(a%b); } template ostream &operator <<(ostream& out,const pair& a){ out<<'('< ostream &operator <<(ostream& out,const vector& a){ out<<'['; REP(i, a.size()) {out<> n; int m = 0, n_ = n; while(n_ > 0) { m++; n_ /= 2; } // cout << m << endl; dp[0][0][0][0] = 1; REP(i, m) REP(j, 2) REP(k, 2) REP(l, 2) { if(dp[i][j][k][l] == 0) continue; // cout << i << " " << j << " " << k << " " << l << " " << dp[i][j][k][l] << " "; int lim = j?1:(n>>(m-i-1)&1); // cout << lim << endl; // (0,0) // cout << i+1 << " " << (j||0