#include <bits/stdc++.h>
using namespace std;
int f(int k) {
  int p = 1;
  while ((p * (p + 1)) / 2 < k) p++;
  if (k == (p * (p + 1)) / 2) return 0;
  p--;
  return (p * (p + 1)) / 2;
}
int main() {
  int n;
  int p = 1;
  cin >> n;
  int k = int((sqrt((8 * n) + 1)) + 1) / 2;
  cout << k << endl;
  vector<int> a[k + 1];
  for (int j = 2; j <= k; j++)
    for (int i = 1; i < j; i++) {
      a[i].push_back(p);
      a[j].push_back(p);
      p++;
    }
  if (f(n))
    for (int i = f(n) + 1; i <= n; i++) {
      a[1].push_back(i);
      a[2].push_back(i);
    }
  for (int i = 1; i <= k; i++) {
    for (int j = 0; j < a[i].size(); j++) cout << a[i][j] << " ";
    cout << endl;
  }
  return 0;
}
