#include <bits/stdc++.h>
using namespace std;
int kq[200][200];
int main() {
  int n, i, j, k;
  scanf("%d", &n);
  k = 3;
  while ((k * (k - 1) / 2) <= n) k++;
  k -= 2;
  cout << k + 1 << endl;
  int b = 1;
  for (i = 0; i < k; i++) {
    for (j = i; j < k; j++) {
      kq[i][j] = b++;
    }
  }
  for (i = 1; i < k + 1; i++) {
    for (j = 0; j < i; j++) {
      kq[i][j] = kq[j][i - 1];
    }
  }
  for (i = 0; i < k + 1; i++) {
    for (j = 0; j < k; j++) {
      cout << kq[i][j] << " ";
    }
    cout << endl;
  }
  return 0;
}
