#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > V;
int main() {
  int i, j, k;
  int N, M;
  cin >> N;
  int sum = 3;
  int count = 3;
  V.push_back(vector<int>());
  V.push_back(vector<int>());
  V.push_back(vector<int>());
  V[0].push_back(1);
  V[0].push_back(2);
  V[1].push_back(1);
  V[1].push_back(3);
  V[2].push_back(2);
  V[2].push_back(3);
  int cur = 4;
  for (i = 3; sum + i <= N; i++) {
    count++;
    int temp = cur;
    for (j = 0; j < i; j++) {
      V[j].push_back(cur);
      cur++;
    }
    V.push_back(vector<int>());
    for (j = 0; j < i; j++) V.back().push_back(temp++);
    sum += i;
  }
  cout << count << endl;
  for (i = 0; i < V.size(); i++) {
    cout << V[i][0];
    for (j = 1; j < V[i].size(); j++) cout << " " << V[i][j];
    cout << endl;
  }
  return 0;
}
