#include <bits/stdc++.h>
using namespace std;
int p[200][200];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m = 0;
  cin >> n;
  int cnt1 = 0, cnt2 = 0;
  while (m * (m + 1) <= 2 * n) m++;
  for (int i = 1; i <= m - 1; i++) {
    for (int j = i; j <= m - 1; j++) {
      p[i][j] = ++cnt1;
    }
  }
  for (int j = 1; j <= m - 1; j++) {
    for (int i = j + 1; i <= m; i++) {
      p[i][j] = ++cnt2;
    }
  }
  cout << m << '\n';
  for (int i = 1; i <= m; i++) {
    for (int j = 1; j <= m - 1; j++) {
      cout << p[i][j] << ' ';
    }
    cout << '\n';
  }
}
