#include <bits/stdc++.h>
using namespace std;
vector<int> res[10002];
int main() {
  int N, val;
  cin >> N;
  for (int i = 1; i * (i - 1) <= (N << 1); i++) val = i;
  cout << val << endl;
  int n = 1;
  for (int i = 1; i <= val; i++)
    for (int j = i + 1; j <= val; j++) {
      res[i].push_back(n);
      res[j].push_back(n);
      n++;
    }
  for (int i = 1; i <= val; i++, cout << endl)
    for (int j = 0; j < val - 1; j++) cout << res[i][j] << " ";
  return 0;
}
