#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> ans[10224];
int main() {
  cin.sync_with_stdio(0);
  cin >> n;
  int days = 0;
  for (int i = 3; i <= n; i++)
    if (i * (i - 1) / 2 <= n) days = i;
  printf("%d\n", days);
  int hobbit = 1;
  for (int i = 1; i <= days; i++)
    for (int j = i + 1; j <= days; j++) {
      ans[i].push_back(hobbit);
      ans[j].push_back(hobbit);
      ++hobbit;
    }
  for (int i = 1; i <= days; i++) {
    for (int j = 0; j < ans[i].size(); j++) printf("%d ", ans[i][j]);
    printf("\n");
  }
  return 0;
}
