#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[1000][1000];
  int n;
  int k = 0, p = 0, z = 1;
  for (int i = 0; i < 5; i++) {
    for (int j = 0; j < 5; j++) a[i][j] = 0;
  }
  cin >> n;
  for (int i = 0;; i++) {
    for (int j = 0; j <= i; j++) {
      a[j][i] = z;
      a[i + 1][j] = z;
      z++;
    }
    if (n < a[i + 1][i]) {
      k = i;
      break;
    }
  }
  cout << k + 1 << endl;
  for (int i = 0; i < k + 1; i++) {
    for (int j = 0; j < k; j++) cout << a[i][j] << " ";
    cout << endl;
  }
  return 0;
}
