111111
 100009
 10011
 1000000
 8
 10201
 102030
 908172
 123456
 415
 900000
 21
 909090
 314159
 999999
 909823
 987654
 1453
 1435
 98
 10
 2
 1

1
111111
 9
100001 1 1 1 1 1 1 1 1
 1
10011
 1
1000000
 8
1 1 1 1 1 1 1 1
 2
10101 100
 3
101010 1010 10
 9
101111 101011 101010 101010 101010 101010 101010 101000 100000
 6
111111 11111 1111 111 11 1
 5
111 101 101 101 1
 9
100000 100000 100000 100000 100000 100000 100000 100000 100000
 2
11 10
 9
101010 101010 101010 101010 101010 101010 101010 101010 101010
 9
111111 101011 101011 1011 11 1 1 1 1
 9
111111 111111 111111 111111 111111 111111 111111 111111 111111
 9
101111 101111 101101 101100 101100 101100 101100 101100 101000
 9
111111 111111 111111 111111 111110 111100 111000 110000 100000
 5
1111 111 111 110 10
 5
1111 111 111 101 1
 9
11 11 11 11 11 11 11 11 10
 1
10
 2
1 1
 1
1



//package practice;
import java.util.*;
import java.io.*;

public class Practice {
       
    
      
       public static String tobinary(int n)
       {
           StringBuilder st=new StringBuilder();
           do
           {
               int temp=n%2;
               
               st.append(Integer.toString(temp));
               n=n/2;
           }while(n!=0);
           st.reverse();
           return st.toString();
       }
       public static int search(int val,int dp[],int start,int end)
       {
          
            int mid=(start+end)/2;
             
            
            if(start>end)
                return -1;
            if(start==end)
                return dp[start];
            if(end==start+1)
            {
                if(dp[end]<val)
                    return dp[end];
                else
                    return dp[start];
            }
            
            if(dp[mid]<val)
            {
                return search(val,dp,mid,end);
            }
            else if(dp[mid]>val)
            {
                return search(val,dp,start,mid);
            }
            else
                return val;
       
       }
   
       public static void main(String[] args)
       { 
          InputReader in=new InputReader(System.in);
          int n=in.nextInt();
          int dp[]=new int[65];
          for(int i=0;i<65;i++)
          {
              dp[i]=Integer.parseInt(tobinary(i));
              //System.out.print(dp[i]+" ");
              
          }
          int count=0;
          int arr[]=new int[n];
          if(n==0)
          {
              count=1;
              arr[0]=0;
          }
          while(n>0)
          {
              int temp=search(n,dp,0,64);
              arr[count]=temp;
              count++;
              n=n-temp;
          }
          System.out.println(count);
          for(int i=0;i<count;i++)
          {
              System.out.print(arr[i]+" ");
          }
          
          
         
          
          
       }
    
    
    
 static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
 
        public InputReader(InputStream stream) {
            this.stream = stream;
        }
 
        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();
 
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }
            
 
            return buf[curChar++];
        }
 
        public int nextInt() {
            int c = read();
 
            while (isSpaceChar(c))
                c = read();
 
            int sgn = 1;
 
            if (c == '-') {
                sgn = -1;
                c = read();
            }
 
            int res = 0;
 
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
 
                res *= 10;
                res += c & 15;
 
                c = read();
            } while (!isSpaceChar(c));
 
            return res * sgn;
        }
 
        public int[] nextIntArray(int arraySize) {
            int array[] = new int[arraySize];
 
            for (int i = 0; i < arraySize; i++)
                array[i] = nextInt();
 
            return array;
        }
 
        public long nextLong() {
            int c = read();
 
            while (isSpaceChar(c))
                c = read();
 
            int sign = 1;
 
            if (c == '-') {
                sign = -1;
 
                c = read();
            }
 
            long result = 0;
 
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
 
                result *= 10;
                result += c & 15;
 
                c = read();
            } while (!isSpaceChar(c));
 
            return result * sign;
        }
 
        public long[] nextLongArray(int arraySize) {
            long array[] = new long[arraySize];
 
            for (int i = 0; i < arraySize; i++)
                array[i] = nextLong();
 
            return array;
        }
 
        public float nextFloat() // problematic
        {
            float result, div;
            byte c;
 
            result = 0;
            div = 1;
            c = (byte) read();
 
            while (c <= ' ')
                c = (byte) read();
 
            boolean isNegative = (c == '-');
 
            if (isNegative)
                c = (byte) read();
 
            do {
                result = result * 10 + c - '0';
            } while ((c = (byte) read()) >= '0' && c <= '9');
 
            if (c == '.')
                while ((c = (byte) read()) >= '0' && c <= '9')
                    result += (c - '0') / (div *= 10);
 
            if (isNegative)
                return -result;
 
            return result;
        }
 
        public double nextDouble() // not completely accurate
        {
            double ret = 0, div = 1;
            byte c = (byte) read();
 
            while (c <= ' ')
                c = (byte) read();
 
            boolean neg = (c == '-');
 
            if (neg)
                c = (byte) read();
 
            do {
                ret = ret * 10 + c - '0';
            } while ((c = (byte) read()) >= '0' && c <= '9');
 
            if (c == '.')
                while ((c = (byte) read()) >= '0' && c <= '9')
                    ret += (c - '0') / (div *= 10);
 
            if (neg)
                return -ret;
 
            return ret;
        }
 
        public String next() {
            int c = read();
 
            while (isSpaceChar(c))
                c = read();
 
            StringBuilder res = new StringBuilder();
 
            do {
                res.appendCodePoint(c);
 
                c = read();
            } while (!isSpaceChar(c));
 
            return res.toString();
        }
 
        public boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }
 
        public String nextLine() {
            int c = read();
 
            StringBuilder result = new StringBuilder();
 
            do {
                result.appendCodePoint(c);
 
                c = read();
            } while (!isNewLine(c));
 
            return result.toString();
        }
 
        public boolean isNewLine(int c) {
            return c == '\n';
        }
 
        public void close() {
            try {
                stream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
 
    }
    
}