import times, strutils, sequtils, math, algorithm, tables, sets, lists, intsets import critbits, future, strformat, deques,heapqueue template `max=`(x,y) = x = max(x,y) template `min=`(x,y) = x = min(x,y) template `mod=`(x,y) = x = x mod y template scan2 = (scan(), scan()) template scan3 = (scan(), scan()) let read* = iterator: string {.closure.} = while true: (for s in stdin.readLine.split: yield s) proc scan(): int = read().parseInt proc scanf(): float = read().parseFloat proc toInt(c:char): int = return int(c) - int('0') proc solve():int= var n = scan() for bx in 1..n: if bx^2 > n: break if n.mod(bx)==0: var x = bx y = n.div(bx) res = 1 flg = false #echo x, ", ", y while x > 0 or y > 0: if (x and 1) > 0 and (y and 1) > 0: res*=2 flg=true if (x and 1) > 0 and (y and 1) == 0: res*=0 if (x and 1) == 0 and (y and 1) > 0: res*=1 if (x and 1) == 0 and (y and 1) == 0: res*=1 x = x shr 1 y = y shr 1 if flg: res = res.div(2) result+=res echo solve()