n = int(input()) r = 0 for x in range(1,int(n**0.5)+1): if n%x: continue y,c = n//x,1 while x: if x%2: c *= y%2*2 x //= 2; y //= 2 r += c print(r//2)