#include <bits/stdc++.h>
using namespace std;
bool book[500010];
int main() {
  int n;
  cin >> n;
  int k;
  for (int i = 1; i <= n; i++) {
    k = 1;
    while (book[k]) {
      book[k] = false;
      k = k + 1;
    }
    book[k] = true;
  }
  int tot = 0;
  for (int i = n; i >= 1; i--)
    if (book[i]) {
      tot++;
    }
  for (int i = n; i >= 1; i--) {
    if (book[i]) {
      tot--;
      cout << i;
      if (tot != 0) cout << " ";
    }
  }
}
