#include <bits/stdc++.h>
using namespace std;
vector<int> v[10000];
int main() {
  int n = ({
    int x;
    scanf("%d", &x);
    x;
  });
  int ans = 2;
  while (ans * (ans + 1) / 2 <= n) {
    ans++;
  }
  int last = 1;
  v[1].push_back(1);
  v[2].push_back(1);
  for (int day = (3); day < (ans + 1); day++) {
    for (int i = 0; i < (day - 1); i++) {
      v[day].push_back(last + 1 + i);
      v[i + 1].push_back(last + 1 + i);
    }
    last += day - 1;
  }
  cout << ans << endl;
  for (int i = (1); i < (ans + 1); i++) {
    for (int j = 0; j < (((int)v[i].size())); j++) {
      cout << v[i][j] << " ";
    }
    puts("");
  }
  return 0;
}
