#include <bits/stdc++.h>
int n;
int mtrx[145][145];
int rs(int x) { return (x * (x - 1)) / 2; }
int bnry() {
  int s = 1, e = 142, m;
  while (s != e) {
    m = (s + e) / 2;
    if (rs(m) <= n && rs(m + 1) > n) break;
    if (rs(m) > n)
      e = m;
    else
      s = m + 1;
  }
  return m;
}
int rpn[142];
int main() {
  scanf("%d", &n);
  int bst = bnry(), i, j;
  printf("%d\n", bst);
  int lst = 1;
  for (i = 0; i < bst; i++) {
    rpn[i] = i;
    for (j = 0; j < i; j++) {
      if (j != 0) printf(" ");
      mtrx[i][j] = mtrx[j][rpn[j]];
      printf("%d", mtrx[j][rpn[j]]);
      rpn[j]++;
    }
    for (j = i; j < bst - 1; j++) {
      if (i != 0 || j != 0) printf(" ");
      mtrx[i][j] = lst;
      printf("%d", lst);
      lst++;
    }
    printf("\n");
  }
}
