#include <bits/stdc++.h>
using namespace std;
int nums[200];
int main() {
  int maxpos;
  for (int i = 0;; ++i) {
    int sonuc = (i * (i + 1)) / 2;
    if (sonuc > 10000) {
      maxpos = i;
      break;
    } else {
      nums[i] = sonuc;
    }
  }
  int n;
  scanf("%d", &n);
  int s = -1;
  for (int i = 0; i < maxpos; ++i) {
    if (nums[i] == n) {
      s = i;
      break;
    } else if (nums[i] > n) {
      s = i - 1;
      break;
    }
  }
  if (s == -1) {
    s = maxpos - 1;
  }
  int sut = s;
  int sat = s + 1;
  vector<vector<int> > v(200);
  printf("%d\n", sat);
  for (int i = 1, last = 1; i <= sat; ++i) {
    for (int j = i; j <= sut; ++j) {
      v[i].push_back(last);
      v[j + 1].push_back(last);
      last++;
    }
    for (int j = 0; j < v[i].size(); ++j) {
      printf("%d ", v[i][j]);
    }
    printf("\n");
  }
  return 0;
}
