#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int kolvo = 0;
  int t = 3;
  int win = 3;
  int nt = 3;
  while (true) {
    if (nt < n) {
      nt += win;
      win++;
    } else
      break;
  }
  if (nt > n) win--;
  vector<vector<int> > A(win + 1);
  int not_use = win;
  for (int i = 1; i < win; i++) A[1].push_back(i);
  for (int i = 2; i <= win; i++) {
    for (int j = 1; j < i; j++) A[i].push_back(A[j][i - 2]);
    for (int j = i; j < win; j++) A[i].push_back(not_use++);
  }
  cout << win << endl;
  for (int i = 1; i <= win; i++) {
    for (int j = 0; j < A[i].size(); j++) cout << A[i][j] << " ";
    cout << endl;
  }
  return 0;
}
