#include <bits/stdc++.h>
using namespace std;
int mp[200][200];
int main() {
  int n;
  cin >> n;
  int m = 3;
  int ans = 3;
  int t = 3;
  while (1) {
    ans += m;
    if (ans > n) {
      break;
    }
    m++;
    t++;
  }
  cout << m << endl;
  int cnt = 1;
  for (int i = 0; i < m - 1; ++i) {
    mp[0][i] = cnt;
    mp[i + 1][0] = cnt++;
  }
  cnt = 1;
  int tc = m;
  for (int i = 1; i < m; ++i) {
    for (int j = cnt; j < m - 1; ++j) {
      mp[i][j] = tc++;
    }
    cnt++;
  }
  cnt = 1;
  tc = m;
  for (int i = 1; i < m; ++i) {
    for (int j = cnt + 1; j < m; ++j) {
      mp[j][i] = tc++;
    }
    cnt++;
  }
  for (int i = 0; i < m; ++i) {
    for (int j = 0; j < m - 1; ++j) {
      if (j == m - 1) {
        cout << mp[i][j] << endl;
        continue;
      }
      cout << mp[i][j] << " ";
    }
    puts("");
  }
  return 0;
}
