#include <bits/stdc++.h>
using namespace std;
int nums[200];
int arr[200][200];
int counter;
int line;
int main() {
  int n;
  cin >> n;
  line = 0;
  counter = 0;
  int sum = 0;
  int nums[200];
  int arr[200][200];
  memset(arr, 0, sizeof arr);
  memset(nums, 0, sizeof nums);
  while (sum + (++counter) <= n) {
    sum += counter;
  }
  cout << counter << endl;
  counter--;
  int i;
  int ct = counter;
  int j;
  arr[0][0] = 1;
  arr[1][0] = 1;
  for (i = 1; i <= counter; i++) {
    arr[i][i] = arr[i - 1][i - 1] + ct;
    ct = ct - 1;
    arr[i + 1][i] = arr[i][i];
  }
  for (i = 0; i <= counter; i++) {
    for (int j = i + 1; j < counter; j++) {
      arr[i][j] = arr[i][j - 1] + 1;
      arr[j + 1][i] = arr[i][j];
    }
  }
  for (i = 0; i <= counter; i++) {
    for (j = 0; j < counter; j++) {
      cout << arr[i][j] << " ";
    }
    cout << endl;
  }
  return 0;
}
