#include <bits/stdc++.h>
using namespace std;
const int INFI_INT = 1 << 30;
const long long INFI_INT64 = (long long)(1 << 30) * (long long)(1 << 30);
const double PI = acos(-1);
template <class T>
T sqr(T x) {
  return x * x;
}
template <class T>
T gcd(T a, T b) {
  return b == 0 ? a : gcd(b, a % b);
}
template <class T>
T absval(T x) {
  return x > 0 ? x : -x;
}
vector<int> a[99999];
void solve() {
  int n, k;
  scanf("%d", &n);
  k = 1;
  while (k * (k + 1) / 2 <= n) ++k;
  int cur = 0;
  for (int i = (int)(1); i <= (int)(k); ++i) a[i].clear();
  for (int i = (int)(1); i <= (int)(k); ++i)
    for (int j = (int)(i + 1); j <= (int)(k); ++j) {
      ++cur;
      a[i].push_back(cur);
      a[j].push_back(cur);
    }
  printf("%d\n", k);
  for (int i = (int)(1); i <= (int)(k); ++i)
    for (int j = 0; j < a[i].size(); ++j)
      printf("%d%c", a[i][j], j < a[i].size() - 1 ? ' ' : '\n');
}
int main() {
  solve();
  return 0;
}
