using System; using System.Text; public class Program { static void Main() { long K = long.Parse(Console.ReadLine()); int ZeroCount = 0; while(K % 2 == 0){ K = K / 2; ZeroCount++; } while(Math.Sqrt(K*8 + 1) % 1.0f != 0 || ((Math.Sqrt(K*8 + 1) + 1) / 2) % 1.0f != 0){ K = K *2; ZeroCount--; } var OneCount = (int)((Math.Sqrt(K*8 + 1) + 1) / 2); Console.WriteLine(OneCount + ZeroCount); var x = new char[OneCount + ZeroCount]; for(var i = OneCount + ZeroCount -1;i>=0;i--){ x[i]= i < OneCount ? '0': '1'; } Console.WriteLine(string.Join(" ",x)); } }