#include <bits/stdc++.h>
using namespace std;
const int Maxn = int(1e5) + 256;
const int INF = int(1e9) + 7;
int n, cur = 1, lvl, sum;
vector<int> v[Maxn];
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    sum += i;
    if (sum > n) {
      lvl = i;
      break;
    }
  }
  for (int i = 1; i <= lvl; ++i) {
    for (int j = i + 1; j <= lvl; ++j) {
      v[i].push_back(cur);
      v[j].push_back(cur);
      cur++;
    }
  }
  cout << lvl << "\n";
  for (int i = 1; i <= lvl; ++i) {
    for (int j = 0; j < (int)(v[i].size()); ++j) {
      cout << v[i][j] << ' ';
    }
    cout << "\n";
  }
  return 0;
}
