#include <bits/stdc++.h>
using namespace std;
char odd[5] = {'1', '3', '5', '7', '9'};
char evn[5] = {'2', '4', '6', '8', '0'};
vector<int> a[1000 + 10];
int n;
int main() {
  cin >> n;
  a[0].push_back(0);
  a[2].push_back(2);
  a[1].push_back(1);
  for (int i = 3; i <= n; i++) {
    int max = -10000;
    int max_index = -1;
    for (int j = 1; j < i; j++) {
      bool ans = true;
      for (int k = 0; k < a[(i - j)].size(); k++) {
        if (a[i - j][k] == j) ans = false;
      }
      if (ans) {
        int size = a[(i - j)].size() + 1;
        if (size > max) {
          max = size;
          max_index = j;
        }
      }
    }
    if (max_index != -1) {
      for (int j = 0; j < a[i - max_index].size(); j++) {
        a[i].push_back(a[i - max_index][j]);
      }
      a[i].push_back(max_index);
    }
  }
  cout << a[n].size() << endl;
  for (int i = 0; i < a[n].size(); i++) {
    cout << a[n][i] << " ";
  }
}
