import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.util.Arrays; import java.util.NoSuchElementException; public class Main { public static void main(String[] args) throws FileNotFoundException { long t = System.currentTimeMillis(); new Main().run(); System.err.println(System.currentTimeMillis() - t); } boolean f(long K) { long n=(long)(Math.sqrt(2*K))+1; return n*(n-1)==2*K; } void run() { Scanner sc = new Scanner(); long K=sc.nextLong(); long n=1; int p=0; while(!f(K)&&K%2==0) { K/=2; ++p; } //n(n-1)/2*2^p=K; while(n*(n-1)/2