#include <bits/stdc++.h>
using namespace std;
int get_length(int n) {
  int r = floor(sqrt(2 * n));
  if ((r + 1) * r > 2 * n)
    return r - 1;
  else
    return r;
}
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int r = get_length(n);
  cout << r + 1 << endl;
  int step = 0;
  int start = 0;
  for (int i = 0; i < r + 1; ++i) {
    if (i > 0) {
      int value = i;
      cout << value << " ";
      for (int j = 1; j < i; j++) {
        value += r - j;
        cout << value << " ";
      }
    }
    for (int j = i; j < r; j++) {
      cout << ++start << " ";
    }
    cout << endl;
  }
  return 0;
}
