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