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