#include <bits/stdc++.h>
using namespace std;
void ASS(bool b) {
  if (!b) {
    ++*(int*)0;
  }
}
#pragma comment(linker, "/STACK:106777216")
vector<int> v[10001];
int main() {
  int n;
  cin >> n;
  for (int k = 10000; k >= 1; k--) {
    if (n >= k * (k - 1) / 2) {
      int id = 0;
      for (int i = 0; i < (int)(k); i++)
        for (int j = 0; j < (int)(i); j++) {
          id++;
          v[i].push_back(id);
          v[j].push_back(id);
        }
      cout << k << endl;
      for (int i = 0; i < (int)(k); i++) {
        for (int j = 0; j < (int)(v[i].size()); j++) {
          cout << v[i][j] << " ";
        }
        cout << endl;
      }
      return 0;
    }
  }
  return 0;
}
