#include <bits/stdc++.h>
using namespace std;
int row, n;
int now;
int main() {
  vector<vector<int> > ans;
  scanf("%d", &n);
  for (int i = 3;; ++i)
    if (i * (i - 1) > 2 * n) {
      row = i - 1;
      break;
    }
  now = 1;
  ans.resize(row);
  for (int i = 0; i < row; ++i)
    for (int j = i + 1; j < row; ++j) {
      ans[i].push_back(now);
      ans[j].push_back(now);
      now++;
    }
  printf("%d\n", row);
  for (int i = 0; i < row; ++i, puts(""))
    for (int j = 0; j < row - 1; ++j) printf("%d ", ans[i][j]);
  return 0;
}
