#include <bits/stdc++.h>
int n, ans, p;
int a[200][200], l[200];
int main() {
  scanf("%d", &n);
  ans = 0;
  p = 0;
  while (p <= n) {
    p += ans;
    ans++;
  }
  ans--;
  printf("%d\n", ans);
  for (int i = 1; i <= ans; i++) l[i] = 0;
  p = 0;
  for (int i = 1; i <= ans; i++)
    for (int j = i + 1; j <= ans; j++) {
      p++;
      a[i][l[i]] = p;
      a[j][l[j]] = p;
      l[i]++;
      l[j]++;
    }
  for (int i = 1; i <= ans; i++) {
    for (int j = 0; j < l[i] - 1; j++) printf("%d ", a[i][j]);
    printf("%d\n", a[i][l[i] - 1]);
  }
  return 0;
}
