#include <bits/stdc++.h>
using namespace std;
long long n, l, r, mid, ans, now(1);
vector<long long> v[10005];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  l = 1, r = 1e6;
  while (l <= r) {
    mid = (l + r) >> 1;
    if (mid * (mid - 1) / 2 <= n) {
      ans = mid;
      l = mid + 1;
    } else {
      r = mid - 1;
    }
  }
  cout << ans << '\n';
  for (int i = 1; i <= ans; i++) {
    for (int j = i + 1; j <= ans; j++) {
      v[i].push_back(now);
      v[j].push_back(now);
      now++;
    }
  }
  for (int i = 1; i <= ans; i++) {
    for (int j = 0; j < v[i].size(); j++) {
      cout << v[i][j] << " ";
    }
    cout << '\n';
  }
}
