#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int num_days = 1;
  int required_hobbits = 1;
  while (n >= required_hobbits) {
    ++num_days;
    required_hobbits += num_days;
  }
  required_hobbits -= num_days;
  vector<bitset<10000> > days(num_days);
  int base = 0;
  for (int size = 0; size < num_days - 1; ++size) {
    for (int hobbit = 0; hobbit < size + 1; ++hobbit) {
      days[hobbit][hobbit + base] = true;
      days[size + 1][hobbit + base] = true;
    }
    base += size + 1;
  }
  cout << num_days << endl;
  for (int i = 0; i < num_days; ++i) {
    for (int j = 0; j < required_hobbits; ++j) {
      if (days[i][j]) cout << j + 1 << " ";
    }
    cout << endl;
  }
  return 0;
}
