#include <bits/stdc++.h>
using namespace std;
int g[205][205];
int main() {
  int n;
  scanf("%d", &n);
  int m = 1;
  while (m * (m + 1) / 2 <= n) m++;
  printf("%d\n", m);
  int ct = 0;
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < i; j++) printf("%d ", g[i][j]);
    for (int j = i; j < m - 1; j++) {
      printf("%d%c", ++ct, j == m - 2 ? '\n' : ' ');
      g[j + 1][i] = ct;
    }
  }
  return 0;
}
