#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, a[500][500];
  cin >> n;
  for (int i = 2;; i++)
    if (i * (i - 1) / 2 > n) {
      k = i - 1;
      break;
    }
  for (int i = 0; i < k; i++) {
    for (int j = i; j < k - 1; j++)
      if (i == 0)
        a[i][j] = j + 1;
      else
        a[i][j] = a[i - 1][j - 1] + k - i;
    for (int j = i + 1; j < k; j++) a[j][i] = a[i][j - 1];
  }
  cout << k << endl;
  for (int i = 0; i < k; cout << endl, i++)
    for (int j = 0; j < k - 1; j++) cout << a[i][j] << ' ';
  return 0;
}
