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