#coding: utf-8 #yuki_3 from collections import deque n=int(raw_input()) d=[0 for i in xrange(n+1)] d[1]=1 q=deque() q.append(1) while q: u=q.popleft() cnt=bin(u).count('1') v1=u+cnt v2=u-cnt if 0