#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int m = 1;
  while (m * (m - 1) <= 2 * n) m++;
  m = m - 1;
  cout << m << '\n';
  int arr[m + 4][m + 3];
  long long k = 1;
  for (int i = 0; i < m; i++) {
    long long count = 0;
    for (int j = i; j < m - 1; j++) {
      arr[i][j] = k + count++;
    }
    count = 0;
    for (long long j = i + 1; j < m; j++) {
      arr[j][i] = k + count++;
    }
    k = k + m - i - 1;
  }
  for (long long i = 0; i < m; i++) {
    for (long long j = 0; j < m - 1; j++) {
      cout << arr[i][j] << " ";
    }
    cout << '\n';
  }
}
