#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, x, i, j, ind;
  cin >> N;
  for (x = 2; (x * (x + 1) / 2) <= N; ++x)
    ;
  --x;
  vector<vector<int> > lists(x + 1, vector<int>(x, 0));
  for (i = 0; i < x; ++i) {
    lists[0][i] = i + 1;
    lists[i + 1][i] = i + 1;
  }
  ind = x + 1;
  for (i = 0; i < x; ++i) {
    for (j = i + 1; j < x; ++j) {
      lists[i + 1][j] = ind;
      lists[j + 1][i] = ind;
      ++ind;
    }
  }
  cout << x + 1 << endl;
  for (i = 0; i < x + 1; i++) {
    for (j = 0; j < x; j++) {
      cout << lists[i][j] << " ";
    }
    cout << endl;
  }
}
