f = lambda x: 1 if x==1 else (f(x-1)+f(x+1) if x%2 else f(x//2))
while True:
try:
print(f(int(input())))
except EOFError:
break