#include <bits/stdc++.h>
using namespace std;
int a[300][300], n, t;
void solve(int x, int y, int now, int res) {
  if (y > t) return;
  for (int i = x + 1; i <= t + 1; ++i) a[i][y] = res + i - x;
  for (int i = y; i <= t; ++i) a[x][i] = res + i - y + 1;
  solve(x + 1, y + 1, now - 1, res + now);
}
int main() {
  cin >> n;
  t = 3;
  while ((t + 1) * t <= 2 * n) ++t;
  cout << t << endl;
  --t;
  solve(1, 1, t, 0);
  for (int i = 1; i <= t + 1; ++i) {
    for (int j = 1; j <= t; ++j) printf("%d ", a[i][j]);
    printf("\n");
  }
  return 0;
}
