#include <bits/stdc++.h>
using namespace std;
int a[300][300];
void out(int r, int c) {
  int i, j;
  for (i = 1; i <= r; i++) {
    for (j = 1; j <= c; j++) cout << a[i][j] << " ";
    cout << endl;
  }
}
void draw(int t) {
  int i, j, k;
  int l = 1;
  int r = 1;
  int max = 1;
  for (k = 1; k <= t - 1; k++) {
    a[l][r] = max;
    for (i = r + 1; i <= t - 1; i++) {
      a[l][i] = a[l][i - 1] + 1;
      max++;
    }
    a[l + 1][r] = a[l][r];
    for (i = l + 2; i <= t; i++) a[i][r] = a[i - 1][r] + 1;
    max++;
    l++;
    r++;
  }
}
int main() {
  int t = 2;
  int n;
  cin >> n;
  while (t * (t + 1) / 2 <= n) t++;
  cout << t << endl;
  draw(t);
  out(t, t - 1);
}
