#include <bits/stdc++.h>
using namespace std;
int tab[10001];
int main() {
  int n, k;
  while (~scanf("%d", &n)) {
    k = (sqrt(8 * n + 1) + 1) / 2;
    printf("%d\n", k);
    int pos = 0;
    for (int i = 0; i < k - 1; ++i) {
      printf("%d ", tab[i] = i + 1);
    }
    printf("\n");
    for (int i = 1; i < k; ++i) {
      for (int j = 0; j < pos; ++j) {
        printf("%d ", ++tab[j]);
      }
      printf("%d ", tab[pos]);
      int tmp = tab[k - 2] + 1;
      for (int j = ++pos; j < k - 1; ++j) {
        tab[j] = tmp++;
        printf("%d ", tab[j]);
      }
      printf("\n");
    }
  }
}
