#![allow(unused_imports)] use std::cmp::*; use std::collections::*; use std::io::Write; use std::ops::Bound::*; #[allow(unused_macros)] macro_rules! debug { ($($e:expr),*) => { #[cfg(debug_assertions)] $({ let (e, mut err) = (stringify!($e), std::io::stderr()); writeln!(err, "{} = {:?}", e, $e).unwrap() })* }; } fn main() { let mut n = read::(); if n == 0 { println!("-1"); return; } let f = |x: i64| 2 * x - 1; let mut answers = vec![]; while n > 0 { for i in (0..42).rev() { let a = 1i64 << i; if a >= 2 * n { continue; } if f(a) <= n { n -= f(a); answers.push(a); break; } } } debug!(answers); println!("{}", answers.len()); for ans in answers { print!("{} ", ans); } println!(""); } fn read() -> T { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); s.trim().parse().ok().unwrap() } fn read_vec() -> Vec { read::() .split_whitespace() .map(|e| e.parse().ok().unwrap()) .collect() }