#include <bits/stdc++.h>
using namespace std;
const int oo = 0x3f3f3f3f;
const double eps = 1e-9;
int N, M;
int main() {
  cin >> M;
  N = 1;
  while (M >= N * (N - 1) / 2) N++;
  N--;
  cout << N << endl;
  int ct = 1;
  for (int i = (0); i < (N); i++) {
    bool f = true;
    for (int j = (0); j < (i); j++) {
      if (!f) cout << " ";
      f = false;
      cout << j * N - j * (j + 1) / 2 + (i - j);
    }
    for (int j = (i); j < (N - 1); j++) {
      if (!f) cout << " ";
      f = false;
      cout << ct;
      ct++;
    }
    cout << endl;
  }
  return 0;
}
