#include <bits/stdc++.h>
using namespace std;
const int inf = 1999999999;
const double pi = acos(-1.0);
const double eps = 1e-9;
char gc() {
  char c;
  while (isspace(c = getchar()))
    ;
  return c;
}
int gs(char* s) {
  fgets(s, 9999999, stdin);
  int l = strlen(s);
  while (l && isspace(s[l - 1])) s[--l] = 0;
  return l;
}
vector<int> v[1000];
int main() {
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  int n;
  cin >> n;
  int k = 0;
  while (k * (k - 1) / 2 <= n) k++;
  k--;
  int c = 1;
  for (int i = 0; i < k; i++) {
    for (int j = 0; j < i; j++) {
      v[i].push_back(c);
      v[j].push_back(c);
      c++;
    }
  }
  cout << k << ('\n');
  for (int i = 0, _i = (k); i < (_i); i++) {
    for (__typeof((v[i]).begin()) j = (v[i]).begin(), _j = (v[i]).end();
         j != (_j); j++) {
      if (j != v[i].begin()) cout << ' ';
      cout << *j;
    }
    cout << ('\n');
  }
  return 0;
}
