#include <bits/stdc++.h>
using namespace std;
vector<int> p[150];
int main() {
  int n, day, i, j, num;
  while (scanf("%d", &n) != EOF) {
    for (i = 0; i < 150; i++) p[i].clear();
    day = 0;
    while (day * (day + 1) <= 2 * n) day++;
    printf("%d\n", day);
    num = 1;
    for (i = 1; i <= day; i++) {
      for (j = i + 1; j <= day; j++) {
        p[i].push_back(num);
        p[j].push_back(num++);
      }
    }
    for (i = 1; i <= day; i++) {
      for (j = 0; j < p[i].size(); j++) {
        if (j) printf(" ");
        printf("%d", p[i][j]);
      }
      printf("\n");
    }
  }
  return 0;
}
