#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int arr[150][150];
  int m = 0, k = 0;
  while (m <= n) {
    k++;
    m = m + k;
  }
  m = m - k;
  cout << k << endl;
  int last = m;
  arr[0][0] = 1;
  arr[0][1] = 2;
  arr[1][0] = 1;
  arr[1][1] = 3;
  arr[2][0] = 2;
  arr[2][1] = 3;
  int c = 2;
  int r = 3;
  int p = 2;
  for (int i = 3; i < m;) {
    int j = i + 1;
    for (int k = 0; k <= p; k++) {
      arr[r][k] = j;
      arr[k][c] = j;
      j++;
    }
    r++, c++;
    p++;
    i = i + p;
  }
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) cout << arr[i][j] << " ";
    cout << endl;
  }
  return 0;
}
