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