#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define all(x) x.begin(), x.end()
#define fastread ios_base::sync_with_stdio(0);cin.tie(NULL)
#define sum(x) accumulate(all(x),0LL)
#define what_is(x) cerr << #x << " = " << (x) << '\n'
#define pb push_back

int main()
{
    fastread;
    int n;
    cin >> n;
    if(n % 3 == 0)
        cout << "1\n";
    else if(n % 3 == 1)
        cout << "2\n";
    else
        cout << "0\n";
    cout << "1 2 3";
    return 0;
}

