#include "bits/stdc++.h" using namespace std; #define print(x) cout< PI; typedef pair V; typedef vector VE; const ll mod = 1000000007; int d[10001]; int binally_count(int n){ string str(std::bitset<32>(n).to_string, std::allocator >()); int cnt=0; REP(i,32){ if(str[i]=='1')cnt++; } return cnt; } int main(){ int n; cin>>n; queue que; REP(i,n+1)d[i]=10001; que.push(1); d[1]=1; while(que.size()){ int p=que.front();que.pop(); if(p==n)break; int pp=p+binally_count(p); if(0