#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<vector<int> > nums;
  int k = 3;
  for (int i = 3;; ++i) {
    if (n < i + k) {
      k = i;
      break;
    } else {
      k += i;
    }
  }
  nums.resize(k);
  cout << k << endl;
  int count = 1;
  for (int i = 0; i < k; ++i) {
    for (int j = 0; j < k - 1; ++j) {
      if (j < i) {
        nums[i].push_back(nums[j][i - 1]);
        cout << nums[j][i - 1] << " ";
      } else {
        nums[i].push_back(count++);
        cout << count - 1 << " ";
      }
    }
    cout << endl;
  }
}
