#include <bits/stdc++.h>
using namespace std;
int main() {
  int n = 0;
  cin >> n;
  double a = (double)n;
  a = sqrt(8 * a + 1);
  int b = ((int)a + 1) / 2;
  cout << b << endl;
  int t[200][200];
  int c = 1;
  for (int i = 1; i <= b; i++) {
    for (int j = i + 1; j <= b; j++) {
      t[i][j] = c;
      t[j][i] = c;
      c++;
    }
  }
  for (int i = 1; i < b; i++) {
    for (int j = 1; j < b; j++) {
      if (i != j) {
        cout << t[i][j] << " ";
      }
    }
    cout << t[i][b] << endl;
  }
  for (int j = 1; j < b; j++) {
    if (b - 1 != j) {
      cout << t[b][j] << " ";
    }
  }
  cout << t[b][b - 1] << endl;
  return 0;
}
