#include <bits/stdc++.h>
using namespace std;
int ifact(int n) {
  int c = (int)sqrt(1 + (8 * n));
  c -= 1;
  c /= 2;
  return c;
}
int main() {
  int n, n1, i, j, c;
  cin >> n;
  n1 = ifact(n);
  cout << n1 + 1 << "\n";
  int m[n1 + 1][n1];
  int k = 1;
  for (i = 0; i < (n1); i++) {
    for (j = i, c = 1; j < n1; j++, c++) {
      m[i][j] = k;
      m[i + c][i] = k;
      k++;
    }
  }
  for (i = 0; i < (n1 + 1); i++) {
    for (j = 0; j < n1; j++) {
      cout << m[i][j] << " ";
    }
    cout << "\n";
  }
  return 0;
}
