#include <bits/stdc++.h>
using namespace std;
const int INF = 1e7 + 7;
const int MOD = 998244353;
const int N = 5e4 + 10;
const int Z = 2e4 + 5;
int n, cnt, mx = 1;
int rr[300][300];
void solve() {
  cin >> n;
  for (cnt = 2; cnt <= n + 10; cnt++) {
    if (cnt * (cnt - 1) / 2 > n) {
      cnt--;
      break;
    }
  }
  cout << cnt << endl;
  for (int i = 1; i <= cnt; i++) {
    for (int j = 1; j < cnt; j++) {
      if (i > j)
        rr[i][j] = rr[j][i - 1];
      else
        rr[i][j] = mx++;
      cout << rr[i][j] << ' ';
    }
    cout << endl;
  }
}
int main() {
  int TE = 1;
  while (TE--) {
    solve();
  }
  return 0;
}
