#include <bits/stdc++.h>
using namespace std;
int mp[510][510];
int main() {
  int n;
  cin >> n;
  int ans = 3;
  while (ans * (ans - 1) / 2 <= n) ans++;
  ans--;
  int tmp = 1;
  for (int i = 0; i < ans; i++)
    for (int j = i + 1; j < ans; j++) {
      mp[i][j - 1] = tmp;
      mp[j][i] = tmp;
      tmp++;
    }
  cout << ans << endl;
  for (int i = 0; i < ans; i++)
    for (int j = 0; j < ans - 1; j++)
      printf("%d%c", mp[i][j], j == ans - 2 ? '\n' : ' ');
  return 0;
}
