#include <bits/stdc++.h>
using namespace std;
int n, x;
vector<int> ans[1000];
void out(int len, int pos = 0, int npos = 1) {
  if (len == 0) return;
  for (int i = 0; i < len; ++i) ans[pos].push_back(npos + i);
  for (int i = 1; i <= len; ++i) ans[pos + i].push_back(npos + i - 1);
  out(len - 1, pos + 1, npos + len);
}
int main() {
  cin >> n;
  for (x = 1; (x * (x + 1)) >> 1 <= n; ++x)
    ;
  --x;
  printf("%d\n", x + 1);
  out(x);
  for (int i = 0; i <= x; ++i) {
    for (int j = 0; j < ans[i].size(); ++j)
      printf("%d%c", ans[i][j], (j + 1 == ans[i].size()) ? '\n' : ' ');
  }
  return 0;
}
