#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, k, n, c[1000], v[1000][1000], count;
  for (i = 0; i < 1000; i++) c[i] = (i * (i + 1)) / 2;
  scanf("%d", &n);
  for (i = 0; i < 1000; i++)
    if (c[i] > n) break;
  k = i - 1;
  count = 1;
  for (i = 0; i < k; i++) {
    for (j = i; j < k; j++) {
      v[i][j] = count;
      v[j + 1][i] = count;
      count++;
    }
  }
  printf("%d\n", k + 1);
  for (i = 0; i < k + 1; i++) {
    for (j = 0; j < k; j++) printf("%d ", v[i][j]);
    printf("\n");
  }
  return 0;
}
