#include <bits/stdc++.h>
using namespace std;
int N, ans[151][151], oo;
int BS(int f, int l, int key) {
  if (f > l) return 0;
  int m = (f + l) / 2;
  if ((m * (m - 1)) / 2 > key)
    return BS(f, m - 1, key);
  else
    return max(m, BS(m + 1, l, key));
}
int main() {
  scanf("%d", &N);
  oo = BS(1, 150, N);
  printf("%d\n", oo);
  int now = 1;
  for (int i = 1; i <= oo; i++) {
    for (int j = 1; j <= i - 1; j++) ans[i][j] = ans[j][i - 1];
    for (int j = i; j <= oo - 1; j++) ans[i][j] = now++;
  }
  for (int i = 1; i <= oo; i++) {
    for (int j = 1; j <= oo - 1; j++) printf("%d ", ans[i][j]);
    printf("\n");
  }
  return 0;
}
