#include <bits/stdc++.h>
int dp[1000];
int mm[200][200];
int main() {
  int i, j, n, m, t;
  dp[3] = 3;
  for (i = 4; i < 1000; ++i) dp[i] = dp[i - 1] + i - 1;
  while (scanf("%d", &n) != EOF) {
    for (i = 3; i < 1000; ++i) {
      if (dp[i] > n) break;
    }
    m = i - 1;
    printf("%d\n", m);
    t = 1;
    for (i = 1; i < m; ++i) {
      for (j = i; j < m; ++j) mm[i][j] = mm[j + 1][i] = t++;
    }
    for (i = 1; i <= m; ++i) {
      for (j = 1; j < m; ++j) printf("%d ", mm[i][j]);
      printf("\n");
    }
  }
  return 0;
}
