#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> ans;
  vector<bool> dp(n);
  int t = n;
  for (int i = 1; i <= n; i++) {
    if (i > t) {
      continue;
    }
    if (dp[i] || dp[t - i]) {
      continue;
    }
    if (t - i == i) {
      continue;
    }
    ans.push_back(i);
    t -= i;
    dp[i] = true;
  }
  cout << ans.size() << '\n';
  for (auto p : ans) {
    cout << p << " ";
  }
}
