import java.util.Scanner;
public class Kolikot {
public static void main(String[] args) {
long[] numbers = new long[44721];
int length = 2;
numbers[0] = 1;
numbers[1] = 2;
long number = Long.parseLong(new Scanner(System.in).nextLine());
int currentIndex = 1;
if(number == 1) {
numbers[1] = 0;
System.exit(0);
}else if(number == 0) {
System.out.println("0");
System.exit(0);
}else if(number == 2) {
numbers[0] = 2;
numbers[1] = 0;
System.exit(0);
}
for(long i = 1; i < number - 2; i++) {
if(currentIndex > -1) {
numbers[currentIndex] += 1;
currentIndex--;
}else {
currentIndex = length;
System.arraycopy(numbers, 0, numbers, 1, length);
length++;
numbers[0] = 1;
}
}
for(long num: numbers) {
if(num == 0)
break;
System.out.print(num + " ");
}
}
}