#include <bits/stdc++.h>
int main() {
  long n, d = 1, t = 1;
  scanf("%ld", &n);
  while (d * (d - 1) / 2 < n) d++;
  if (d * (d - 1) / 2 > n) d--;
  std::vector<std::vector<long> > v(d);
  printf("%ld\n", d);
  for (long i = 0; i < d; i++)
    for (long j = i + 1; j < d; j++) {
      v[i].push_back(t);
      v[j].push_back(t);
      t++;
    }
  for (long i = 0; i < d; i++) {
    for (long j = 0; j < d - 1; j++) printf("%ld ", v[i][j]);
    printf("\n");
  }
}
