#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using pi = pair<int, int>;
using vs = vector<string>;
using vpi = vector<pi>;
using ll = long long int;
template <typename T>
string tostr(T x) {
  ostringstream oss;
  oss << x;
  return oss.str();
}
template <typename T1, typename T2, typename T3>
T1 modpow(T1 a, T2 p, T3 mod) {
  T1 ret = 1;
  a %= mod;
  for (; p > 0; p /= 2) {
    if (p & 1) ret = 1ll * ret * a % mod;
    a = 1ll * a * a % mod;
  }
  return ret;
}
int dx[]{-1, 0, 1, 0, 1, 1, -1, -1};
int dy[]{0, -1, 0, 1, 1, -1, 1, -1};
constexpr auto PI = 3.14159265358979323846L;
constexpr auto oo = numeric_limits<int>::max() / 2 - 10;
constexpr auto eps = 1e-6;
constexpr auto mod = 1000000007;
constexpr int mx_k = 150;
vi ans[mx_k];
int n;
int main() {
  scanf("%d", &n);
  int k = 0;
  for (; k * (k - 1) / 2 <= n; ++k)
    ;
  --k;
  int idx = 1;
  for (auto i = 0, _i = (k); i < _i; ++i)
    for (auto j = i + 1, _j = (k); j < _j; ++j) {
      ans[i].push_back(idx);
      ans[j].push_back(idx);
      ++idx;
    }
  printf("%d\n", k);
  for (auto i = 0, _i = (k); i < _i; ++i) {
    for (int x : ans[i]) {
      printf("%d ", x);
    }
    printf("\n");
  }
  return 0;
}
