#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  int l = 0, r = n, m = 0, pr = -1;
  while (r - l > 0) {
    m = (l + r) / 2;
    if (m * (m - 1) / 2 >= n) {
      r = m;
    } else {
      l = m + 1;
    }
    if (m * (m - 1) / 2 == n) {
      l = m;
      break;
    }
  }
  if (l * (l - 1) / 2 > n) {
    l--;
  }
  cout << l << "\n";
  vector<int> ans[10000];
  int tec = 1;
  for (int i = 0; i < l; ++i) {
    for (int j = i + 1; j < l; ++j) {
      ans[j].push_back(tec);
      ans[i].push_back(tec);
      tec++;
    }
  }
  for (int i = 0; i < l; ++i) {
    for (auto it_ : ans[i]) {
      cout << it_ << " ";
    }
    cout << "\n";
  }
}
