#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > solve(int N) {
  vector<vector<int> > res(2, vector<int>(1, 1));
  for (int n = 2, r = 0; n <= N; ++n) {
    res[r].push_back(n);
    ++r;
    if (r >= int((res).size())) {
      vector<int> new_row;
      for (const vector<int>& r : res) new_row.push_back(r.back());
      res.push_back(new_row);
      r = 0;
    }
  }
  return res;
}
int main(int argc, char* argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin >> N;
  vector<vector<int> > res = solve(N);
  cout << int((res).size()) << '\n';
  for (const vector<int>& row : res) {
    for (int x : row) cout << x << ' ';
    cout << '\n';
  }
  return 0;
}
