#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  while (cin >> n) {
    int val = 0;
    for (int i = 1; i <= n; i++) {
      if ((i * (i + 1)) <= 2 * n) {
        val = i;
      } else
        break;
    }
    cout << val + 1 << endl;
    int c[val + 1][val];
    int cont = 1;
    for (int i = 0; i < val; i++) {
      c[i][i] = cont;
      c[i + 1][i] = cont;
      cont++;
      for (int j = i + 1; j < val; j++) {
        c[i][j] = cont;
        c[j + 1][i] = cont;
        cont++;
      }
    }
    for (int i = 0; i < val + 1; i++) {
      for (int j = 0; j < val; j++) {
        if (j == val - 1)
          cout << c[i][j];
        else
          cout << c[i][j] << " ";
      }
      cout << endl;
    }
  }
  return 0;
}
