#include <bits/stdc++.h>   using namespace std;   int m[1000][1000];   int main() {     m[0][0] = 1;     m[0][1] = 2;     m[1][0] = 2;     m[1][1] = 3;     m[2][0] = 3;     m[2][1] = 1;     int n;     scanf( %d , &n);     int g = 4;     int d = 2;     int cur = 0;     while (g <= n) {       m[cur][d] = g;       ++g;       if (cur == d) {         ++d;         for (int i = 0; i < d; ++i) {           m[d][i] = m[i][d - 1];         }         cur = 0;       } else         ++cur;     }     printf( %d n , d + 1);     for (int i = 0; i <= d; ++i) {       for (int j = 0; j < d; ++j) {         printf( %d  , m[i][j]);       }       printf(  n );     }     return 0;   }   