/*
`-/oo+/- ``
.oyhhhhhhyo.`od
+hhhhyyoooos. h/
+hhyso++oosy- /s
.yoooossyyo:``-y`
..----.` ``.-/+:.`
`````..-::/.
`..```.-::///`
`-.....--::::/:
`.......--::////:
`...`....---:::://:
`......``..--:::::///:`
`---.......--:::::////+/`
----------::::::/::///++:
----:---:::::///////////:`
.----::::::////////////:-`
`----::::::::::/::::::::-
`.-----:::::::::::::::-
...----:::::::::/:-`
`.---::/+osss+:`
``.:://///-.
*/
#include <bits/stdc++.h>
#define debug(x) cerr << #x << " " << x << '\n'
#define debugsp(x) cerr << #x << " " << x << ' '
using namespace std;
ifstream in ("lacate.in");
ofstream out ("lacate.out");
const int INF = 1e9;
const int N = 256;
int a[1 + N][N];
int main() {
int n;
in >> n;
out << n * (n - 1) / 2 << ' ' << n - 1 << '\n';
int cnt = 1;
for(int i = 1; i < n; i++) {
int ccnt = cnt;
for(int j = i; j < n; j++)
a[i][j] = ccnt++;
for(int j = i + 1; j <= n; j++)
a[j][i] = cnt++;
}
for(int i = 1; i <= n; i++, out << '\n')
for(int j = 1; j < n; j++)
out << a[i][j] << ' ';
return 0;
}