#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
using namespace std;
#define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define snuke(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
int N,K;
int ans[1000000][3];
void add(int x, int y, int z){
ans[K][0] = x % N + 1;
ans[K][1] = y % N + 1;
ans[K][2] = z % N + 1;
K++;
}
int main(void){
int i,j;
cin >> N;
bool even = (N % 2 == 0);
if(even) N--;
for(i=1;2*i<N;i++) REP(j,N) add(j, j+i, j+2*i);
if(even){
for(i=2;2*i<N;i++) REP(j,N) add(j, j+i, j+2*i);
N++;
REP(i,N-1) add(N-1, i, (i+1)%(N-1));
REP(i,N-1) add(N-1, i, (i+1)%(N-1));
REP(i,N-1) add(N-1, i, (i+2)%(N-1));
}
cout << K << endl;
REP(i,K) printf("%d %d %d\n", ans[i][0], ans[i][1], ans[i][2]);
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3N0cmVhbT4KI2luY2x1ZGUgPGZzdHJlYW0+CiNpbmNsdWRlIDxzdHJpbmc+CiNpbmNsdWRlIDx2ZWN0b3I+CiNpbmNsdWRlIDxkZXF1ZT4KI2luY2x1ZGUgPHF1ZXVlPgojaW5jbHVkZSA8c3RhY2s+CiNpbmNsdWRlIDxzZXQ+CiNpbmNsdWRlIDxtYXA+CiNpbmNsdWRlIDxhbGdvcml0aG0+CiNpbmNsdWRlIDxmdW5jdGlvbmFsPgojaW5jbHVkZSA8dXRpbGl0eT4KI2luY2x1ZGUgPGJpdHNldD4KI2luY2x1ZGUgPGNtYXRoPgojaW5jbHVkZSA8Y3N0ZGxpYj4KI2luY2x1ZGUgPGN0aW1lPgojaW5jbHVkZSA8Y3N0ZGlvPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCiNkZWZpbmUgUkVQKGksbikgZm9yKChpKT0wOyhpKTwoaW50KShuKTsoaSkrKykKI2RlZmluZSBzbnVrZShjLGl0cikgZm9yKF9fdHlwZW9mKChjKS5iZWdpbigpKSBpdHI9KGMpLmJlZ2luKCk7aXRyIT0oYykuZW5kKCk7aXRyKyspCgppbnQgTixLOwppbnQgYW5zWzEwMDAwMDBdWzNdOwoKdm9pZCBhZGQoaW50IHgsIGludCB5LCBpbnQgeil7CglhbnNbS11bMF0gPSB4ICUgTiArIDE7CglhbnNbS11bMV0gPSB5ICUgTiArIDE7CglhbnNbS11bMl0gPSB6ICUgTiArIDE7CglLKys7Cn0KCmludCBtYWluKHZvaWQpewoJaW50IGksajsKCQoJY2luID4+IE47CgkKCWJvb2wgZXZlbiA9IChOICUgMiA9PSAwKTsKCWlmKGV2ZW4pIE4tLTsKCQoJZm9yKGk9MTsyKmk8TjtpKyspIFJFUChqLE4pIGFkZChqLCBqK2ksIGorMippKTsKCQoJaWYoZXZlbil7CgkJZm9yKGk9MjsyKmk8TjtpKyspIFJFUChqLE4pIGFkZChqLCBqK2ksIGorMippKTsKCQlOKys7CgkJUkVQKGksTi0xKSBhZGQoTi0xLCBpLCAoaSsxKSUoTi0xKSk7CgkJUkVQKGksTi0xKSBhZGQoTi0xLCBpLCAoaSsxKSUoTi0xKSk7CgkJUkVQKGksTi0xKSBhZGQoTi0xLCBpLCAoaSsyKSUoTi0xKSk7Cgl9CgkKCWNvdXQgPDwgSyA8PCBlbmRsOwoJUkVQKGksSykgcHJpbnRmKCIlZCAlZCAlZFxuIiwgYW5zW2ldWzBdLCBhbnNbaV1bMV0sIGFuc1tpXVsyXSk7CgkKCXJldHVybiAwOwp9Cg==
Main.java:1: error: illegal character: '#'
#include <iostream>
^
Main.java:1: error: class, interface, or enum expected
#include <iostream>
^
Main.java:2: error: illegal character: '#'
#include <sstream>
^
Main.java:3: error: illegal character: '#'
#include <fstream>
^
Main.java:4: error: illegal character: '#'
#include <string>
^
Main.java:5: error: illegal character: '#'
#include <vector>
^
Main.java:6: error: illegal character: '#'
#include <deque>
^
Main.java:7: error: illegal character: '#'
#include <queue>
^
Main.java:8: error: illegal character: '#'
#include <stack>
^
Main.java:9: error: illegal character: '#'
#include <set>
^
Main.java:10: error: illegal character: '#'
#include <map>
^
Main.java:11: error: illegal character: '#'
#include <algorithm>
^
Main.java:12: error: illegal character: '#'
#include <functional>
^
Main.java:13: error: illegal character: '#'
#include <utility>
^
Main.java:14: error: illegal character: '#'
#include <bitset>
^
Main.java:15: error: illegal character: '#'
#include <cmath>
^
Main.java:16: error: illegal character: '#'
#include <cstdlib>
^
Main.java:17: error: illegal character: '#'
#include <ctime>
^
Main.java:18: error: illegal character: '#'
#include <cstdio>
^
Main.java:22: error: illegal character: '#'
#define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)
^
Main.java:22: error: class, interface, or enum expected
#define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)
^
Main.java:22: error: class, interface, or enum expected
#define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)
^
Main.java:22: error: class, interface, or enum expected
#define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)
^
Main.java:23: error: illegal character: '#'
#define snuke(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
^
Main.java:23: error: class, interface, or enum expected
#define snuke(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
^
Main.java:23: error: class, interface, or enum expected
#define snuke(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
^
Main.java:26: error: class, interface, or enum expected
int ans[1000000][3];
^
Main.java:28: error: class, interface, or enum expected
void add(int x, int y, int z){
^
Main.java:30: error: class, interface, or enum expected
ans[K][1] = y % N + 1;
^
Main.java:31: error: class, interface, or enum expected
ans[K][2] = z % N + 1;
^
Main.java:32: error: class, interface, or enum expected
K++;
^
Main.java:33: error: class, interface, or enum expected
}
^
Main.java:38: error: class, interface, or enum expected
cin >> N;
^
Main.java:40: error: class, interface, or enum expected
bool even = (N % 2 == 0);
^
Main.java:41: error: class, interface, or enum expected
if(even) N--;
^
Main.java:43: error: class, interface, or enum expected
for(i=1;2*i<N;i++) REP(j,N) add(j, j+i, j+2*i);
^
Main.java:43: error: class, interface, or enum expected
for(i=1;2*i<N;i++) REP(j,N) add(j, j+i, j+2*i);
^
Main.java:43: error: class, interface, or enum expected
for(i=1;2*i<N;i++) REP(j,N) add(j, j+i, j+2*i);
^
Main.java:45: error: class, interface, or enum expected
if(even){
^
Main.java:46: error: class, interface, or enum expected
for(i=2;2*i<N;i++) REP(j,N) add(j, j+i, j+2*i);
^
Main.java:46: error: class, interface, or enum expected
for(i=2;2*i<N;i++) REP(j,N) add(j, j+i, j+2*i);
^
Main.java:47: error: class, interface, or enum expected
N++;
^
Main.java:48: error: class, interface, or enum expected
REP(i,N-1) add(N-1, i, (i+1)%(N-1));
^
Main.java:49: error: class, interface, or enum expected
REP(i,N-1) add(N-1, i, (i+1)%(N-1));
^
Main.java:50: error: class, interface, or enum expected
REP(i,N-1) add(N-1, i, (i+2)%(N-1));
^
Main.java:51: error: class, interface, or enum expected
}
^
Main.java:54: error: class, interface, or enum expected
REP(i,K) printf("%d %d %d\n", ans[i][0], ans[i][1], ans[i][2]);
^
Main.java:56: error: class, interface, or enum expected
return 0;
^
Main.java:57: error: class, interface, or enum expected
}
^
49 errors