#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  scanf("%d", &n);
  vector<int> u[150];
  for (m = 1; m * (m + 1) / 2 <= n; m++)
    ;
  for (int i = 0; i < m; i++)
    for (int j = i + 1; j < m; j++) {
      u[i].push_back(n);
      u[j].push_back(n);
      n--;
    }
  printf("%d\n", m);
  for (int i = 0; i < m; i++) {
    for (auto c : u[i]) printf("%d ", c);
    puts("");
  }
}
