#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> ans[1000];
int main() {
  cin >> n;
  int k = 2;
  while ((k * (k + 1)) / 2 <= n) k++;
  int cnt = 1;
  for (int i = 1; i <= k; i++)
    for (int j = 1; j < i; j++) {
      ans[i].push_back(cnt);
      ans[j].push_back(cnt);
      cnt++;
    }
  cout << k << endl;
  for (int i = 1; i <= k; i++) {
    for (int j = 0; j < ans[i].size(); j++) cout << ans[i][j] << ' ';
    cout << endl;
  }
  return 0;
}
