#include <bits/stdc++.h>
using namespace std;
const int maxN = 2000 + 321;
vector<int> a[maxN];
int main() {
  int n;
  cin >> n;
  int k = 2 * n;
  k = sqrt(k);
  if ((k + 1) * k / 2 <= n) k++;
  int count = 1;
  for (int i = 0; i < k - 1; i++) {
    for (int j = i + 1; j < k; j++) {
      a[i].push_back(count);
      a[j].push_back(count);
      count++;
    }
  }
  cout << k << endl;
  for (int i = 0; i < k; i++) {
    for (int j = 0; j < a[i].size(); j++) cout << a[i][j] << ' ';
    cout << endl;
  }
  return 0;
}
