#include #define FOREACH(it,c) for( __typeof((c).begin()) it=(c).begin();it!=(c).end();it++) #define FOR(a,b,c) for(int a=(b);a<=(c);++a) #define ROF(a,b,c) for(int a=(b);a>=(c);--a) #define dbg(x) cout<<#x<<" = "<<(x)<<"\n"; #define pii pair #define pil pair< pair< int, int> , ind > #define mp make_pair #define pb push_back #define fi first.first #define se first.second #define ind second #define ll long long #define TATA NULL using namespace std; const int NMAX = 100002; vector < int > sol; int main(){ #ifndef ONLINE_JUDGE freopen("data.in","r",stdin); #endif // ONLINE_JUDGE cin.sync_with_stdio(false); cin.tie(TATA); bool ans; int n,start ; cin >> n; for(int i=1;i<=n;) { start = i; sol.push_back(start); if(start == n) break; int len = 0; for(int j=1;j<17;j++) { len += 1<>ans; if(ans == 0) { if(j==1) { i = start + len; break; } else{ len += 1 << (j-1); j = 0; } } else len -= 1<