#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000000;
const int prime = 9241;
int q[305][305];
int v[305];
int main() {
  int n;
  cin >> n;
  int ans = 0, phi = 0;
  for (int i = 3; i <= min(300, n); i++) {
    ans = i;
    for (int j = 0; j < i; j++)
      for (int k = 0; k < i; k++) q[j][k] = 0;
    int p = 1;
    for (int j = 0; j < i; j++) {
      for (int k = j; k < i - 1; k++) q[j][k] = p++;
      for (int k = j; k < i - 1; k++) q[k + 1][j] = q[j][k];
    }
    phi = p - 1;
    if (phi > n) break;
  }
  if (phi > n) ans--;
  for (int j = 0; j < ans; j++)
    for (int k = 0; k < ans; k++) q[j][k] = 0;
  int p = 1;
  for (int j = 0; j < ans; j++) {
    for (int k = j; k < ans - 1; k++) q[j][k] = p++;
    for (int k = j; k < ans - 1; k++) q[k + 1][j] = q[j][k];
  }
  cout << ans << endl;
  for (int i = 0; i < ans; i++) {
    for (int j = 0; j < ans - 1; j++) cout << q[i][j] << ' ';
    cout << endl;
  }
}
