k = gets.to_i if k == 0 puts 1 puts "0" exit end 2.upto(30) do |i| hoge = i * (i - 1) / 2 if k % hoge != 0 next end cnt = 0 tmp = k / hoge while tmp % 2 == 0 cnt += 1 tmp /= 2 end if tmp == 1 && cnt + i <= 30 puts cnt + i a = [] cnt.times do a.push(0) end i.times do a.push(1) end puts a.join(' ') break end end