#include using namespace std; int main(){ int n;cin>>n; vector dist(n+1,-1); dist[1]=1; queue que; que.push(1); while(!que.empty()){ int u=que.front();que.pop(); bitset<14> bit(u); if(u+bit.count()<=n&&dist[u+bit.count()]==-1){ dist[u+bit.count()]=dist[u]+1; que.push(u+bit.count()); } if(u-bit.count()>0&&dist[u-bit.count()]==-1){ dist[u-bit.count()]=dist[u]+1; que.push(u-bit.count()); } } cout<