K=int(input()) if K==0: print(0) print() exit() for i in range(2,10000000): x=i*(i-1)//2 if K%x==0: r=K//x for j in range(31): if r==(1<