#pragma GCC optimize(1)
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
#pragma G++ optimize(1)
#pragma G++ optimize(2)
#pragma G++ optimize(3)
#pragma G++ optimize("Ofast")
#pragma G++ optimize("inline")
#pragma G++ optimize("-fgcse")
#pragma G++ optimize("-fgcse-lm")
#pragma G++ optimize("-fipa-sra")
#pragma G++ optimize("-ftree-pre")
#pragma G++ optimize("-ftree-vrp")
#pragma G++ optimize("-fpeephole2")
#pragma G++ optimize("-ffast-math")
#pragma G++ optimize("-fsched-spec")
#pragma G++ optimize("unroll-loops")
#pragma G++ optimize("-falign-jumps")
#pragma G++ optimize("-falign-loops")
#pragma G++ optimize("-falign-labels")
#pragma G++ optimize("-fdevirtualize")
#pragma G++ optimize("-fcaller-saves")
#pragma G++ optimize("-fcrossjumping")
#pragma G++ optimize("-fthread-jumps")
#pragma G++ optimize("-funroll-loops")
#pragma G++ optimize("-fwhole-program")
#pragma G++ optimize("-freorder-blocks")
#pragma G++ optimize("-fschedule-insns")
#pragma G++ optimize("inline-functions")
#pragma G++ optimize("-ftree-tail-merge")
#pragma G++ optimize("-fschedule-insns2")
#pragma G++ optimize("-fstrict-aliasing")
#pragma G++ optimize("-fstrict-overflow")
#pragma G++ optimize("-falign-functions")
#pragma G++ optimize("-fcse-skip-blocks")
#pragma G++ optimize("-fcse-follow-jumps")
#pragma G++ optimize("-fsched-interblock")
#pragma G++ optimize("-fpartial-inlining")
#pragma G++ optimize("no-stack-protector")
#pragma G++ optimize("-freorder-functions")
#pragma G++ optimize("-findirect-inlining")
#pragma G++ optimize("-frerun-cse-after-loop")
#pragma G++ optimize("inline-small-functions")
#pragma G++ optimize("-finline-small-functions")
#pragma G++ optimize("-ftree-switch-conversion")
#pragma G++ optimize("-foptimize-sibling-calls")
#pragma G++ optimize("-fexpensive-optimizations")
#pragma G++ optimize("-funsafe-loop-optimizations")
#pragma G++ optimize("inline-functions-called-once")
#pragma G++ optimize("-fdelete-null-pointer-checks")
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mem(x,y) memset(x,y,sizeof(x))
const int M=2e5+10;
const ll mod=1e9+7;
const int bit=32;
const ll inf=0x3f3f3f3f;
const double pi=acos(-1.0);
ll dp[M][3][2][2];
int a[M];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
	}
	for(int i=0;i<=n;i++){
		for(int j=0;j<3;j++){
			for(int k=0;k<2;k++){
				for(int l=0;l<2;l++)
				dp[i][j][k][l]=-inf*inf;
			}
		}
	}
	if(n==1){
		printf("%lld\n",a[1]);
		return 0;
	}
	dp[1][1][1][0]=a[1];
	dp[1][2][0][0]=-a[1];
	for(int i=1;i<=n;i++){
		for(int j=0;j<=2;j++){
			for(int k=0;k<2;k++){
				for(int l=0;l<2;l++){
					dp[i+1][(j+1)%3][1][l||k==1]=max(dp[i+1][(j+1)%3][1][l||k==1],dp[i][j][k][l]+a[i+1]);
					dp[i+1][(j+2)%3][0][l||k==0]=max(dp[i+1][(j+2)%3][0][l||k==0],dp[i][j][k][l]-a[i+1]);
				}
			}
		}
	}
	printf("%lld\n",max(dp[n][1][1][1],dp[n][1][0][1]));
	return 0;
}


#include <stdio.h>
#include <vector>
#include <algorithm>
#include <climits>
#include <cstring>

std::vector<std::pair<long long, int>> input;
long long sum[200010];
int n;
bool sign[200010];

bool OK(int num) {
	if (n % 2 == 0 && num != n / 2)
		return true;
	if (n % 2 == 1 && num != n / 2 && num != n / 2 + 1)
		return true;

	memset(sign, false, sizeof(sign));
	for (int i = num; i < input.size(); i++)
		sign[input[i].second] = true;

	for (int i = 1; i < n; i++) {
		if (sign[i] == sign[i + 1])
			return true;
	}
	return false;
}

int main(void) {
	scanf("%d", &n);

	for (int i = 1; i <= n; i++) {
		long long a;
		scanf("%I64d", &a);
		input.push_back(std::make_pair(a, i));
	}
	if (n == 1) {
		printf("%I64d\n", input[0].first);
		return 0;
	}

	if (n == 2) {
		printf("%I64d\n", -1 * (input[0].first + input[1].first));
		return 0;
	}

	std::sort(input.begin(), input.end());
	for (int i = 0; i < input.size(); i++)
		sum[i + 1] = sum[i] + input[i].first;

	int start = 0;
	if (n % 3 == 0) start = 1;
	else if (n % 3 == 1) start = 0;
	else start = 2;

	long long result = LLONG_MIN / 2;
	for (int i = start; i <= n; i += 3) {
		long long left = sum[i], right = sum[n] - sum[i];

		if (!OK(i)) {
			left = left - input[i - 1].first + input[i].first;
			right = right - input[i].first + input[i - 1].first;
		}

		result = std::max(result, right - left);
	}

	printf("%I64d\n", result);
}


#include <stdio.h>
#include <vector>
#include <algorithm>
#include <climits>
#include <cstring>

std::vector<std::pair<long long, int>> input;
long long sum[200010];
int n;
bool sign[200010];

bool OK(int num) {
	if (n % 2 == 0 && num != n / 2)
		return true;
	if (n % 2 == 1 && num != n / 2 && num != n / 2 + 1)
		return true;

	memset(sign, false, sizeof(sign));
	for (int i = num; i < input.size(); i++)
		sign[input[i].second] = true;

	for (int i = 1; i < n; i++) {
		if (sign[i] == sign[i + 1])
			return true;
	}
	return false;
}

int main(void) {
	scanf("%d", &n);

	for (int i = 1; i <= n; i++) {
		long long a;
		scanf("%I64d", &a);
		input.push_back(std::make_pair(a, i));
	}

	std::sort(input.begin(), input.end());
	for (int i = 0; i < input.size(); i++)
		sum[i + 1] = sum[i] + input[i].first;

	int start = 0;
	if (n % 3 == 0) start = 1;
	else if (n % 3 == 1) start = 0;
	else start = 2;

	long long result = LLONG_MIN / 2;
	for (int i = start; i <= n; i += 3) {
		long long left = sum[i], right = sum[n] - sum[i];

		if (!OK(i)) {
			left = left - input[i].first + input[i + 1].first;
			right = right - input[i + 1].first + input[i].first;
		}

		result = std::max(result, right - left);
	}

	printf("%I64d\n", result);
}


#include<cstdio>
#include<cstring>
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<functional>
#include<cctype>
#include<stack>
#include<set>
#include<queue>
#include<vector>
#include<queue>
#include<cmath>
#define IADDR "C:\\Users\\SZUCPC\\Desktop\\in.txt","r",stdin
using namespace std;
typedef long long LL;
const double pi=acos((double)-1.0);
const double eps=1e-6;
const int INF_INT=0x3f3f3f3f;
const LL INF_LL=0x3f3f3f3f3f3f3f3f;
const LL MOD=(1?1000000007:998244353);
inline int read(){  char c=getchar();    int x=0, f= 1;    while(c<'0'||c>'9'){if(c == '-') f = -1; c = getchar();}  while(c>='0'&&c<='9')  x=(x<<3)+(x<<1)+c-'0',c=getchar();  return x * f;}
inline LL readLL(){  char c=getchar();    LL x=0, f= 1;    while(c<'0'||c>'9'){if(c == '-') f = -1; c = getchar();}  while(c>='0'&&c<='9')  x=(x<<3LL)+(x<<1LL)+(LL)(c-'0'),c=getchar();  return x * f;}

const int maxn=200100,maxlg=20;
LL d[maxn],n;
LL dp[maxn][3][2][2];
LL getdp()
{
    if(n==1)
        return abs(d[1]);
    for(int i=0;i<=n;++i)
        for(int j=0;j<3;++j)
            for(int k=0;k<2;++k)
                for(int l=0;l<2;++l)
                    dp[i][j][k][l]=-INF_LL;
    dp[1][n%3][0][0]=d[1];
    dp[1][(n+1)%3][0][1]=-d[1];
    for(int i=0;i<n;++i)
        for(int j=0;j<3;++j)
            for(int k=0;k<2;++k)
                for(int l=0;l<2;++l)
                if(dp[i][j][k][l]>-INF_LL)
                {
                    dp[i+1][(j+1)%3][k|(l==1)][1]= max(dp[i+1][(j+1)%3][k|(l==1)][1], dp[i][j][k][l]-d[i+1]);
                    dp[i+1][j      ][k|(l==0)][0]= max(      dp[i+1][j][k|(l==0)][0], dp[i][j][k][l]+d[i+1]);
                }
    return max(dp[n][1][1][1], dp[n][1][1][0]);
}
int main()
{
  //  freopen(IADDR);
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    n=readLL();
    for(int i=1;i<=n;++i)
        d[i]=readLL();
    printf("%lld\n",getdp());

    return 0;
}


#include<cstdio>
#include<cstring>
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<functional>
#include<cctype>
#include<stack>
#include<set>
#include<queue>
#include<vector>
#include<queue>
#include<cmath>
#define IADDR "C:\\Users\\SZUCPC\\Desktop\\in.txt","r",stdin
using namespace std;
typedef long long LL;
const double pi=acos((double)-1.0);
const double eps=1e-6;
const int INF_INT=0x3f3f3f3f;
const LL INF_LL=0x3f3f3f3f3f3f3f3f;
const LL MOD=(1?1000000007:998244353);
inline int read(){  char c=getchar();    int x=0, f= 1;    while(c<'0'||c>'9'){if(c == '-') f = -1; c = getchar();}  while(c>='0'&&c<='9')  x=(x<<3)+(x<<1)+c-'0',c=getchar();  return x * f;}
inline LL readLL(){  char c=getchar();    LL x=0, f= 1;    while(c<'0'||c>'9'){if(c == '-') f = -1; c = getchar();}  while(c>='0'&&c<='9')  x=(x<<3LL)+(x<<1LL)+(LL)(c-'0'),c=getchar();  return x * f;}

const int maxn=200100,maxlg=20;
LL d[maxn],n;
LL dp[maxn][3][2][2];
LL getdp()
{
    if(n==1)
        return abs(d[1]);
    for(int i=0;i<n;++i)
        for(int j=0;j<3;++j)
            for(int k=0;k<2;++k)
                for(int l=0;l<2;++l)
                    dp[i][j][k][l]=-INF_LL;
    dp[1][n%3][0][0]=d[1];
    dp[1][(n+1)%3][0][1]=-d[1];
    for(int i=0;i<n;++i)
        for(int j=0;j<3;++j)
            for(int k=0;k<2;++k)
                for(int l=0;l<2;++l)
                if(dp[i][j][k][l]>-INF_LL)
                {
                    dp[i+1][(j+1)%3][k|(l==1)][1]= max(dp[i+1][(j+1)%3][k|(l==1)][1], dp[i][j][k][l]-d[i+1]);
                    dp[i+1][j      ][k|(l==0)][0]= max(      dp[i+1][j][k|(l==0)][0], dp[i][j][k][l]+d[i+1]);
                }
    return max(dp[n][1][1][1], dp[n][1][1][0]);
}
int main()
{
  //  freopen(IADDR);
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    n=readLL();
    for(int i=1;i<=n;++i)
        d[i]=readLL();
    printf("%lld\n",getdp());

    return 0;
}


//orz Gold_7
//orz SqwrIwy
//orz yzh1505
//orz yzh2019
//orz new
//orz hejinfan
//orz chenkuowen
//#pragma comment(linker,?STACK:1677721600?
//#pragma GCC optimize("O2")
//#pragma G++ optimize("O2")
//#pragma GCC optimize("O3")
//#pragma G++ optimize("O3")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
//typedef __int128 ll;
typedef unsigned int uint;
typedef unsigned long long ull;
//typedef double db;
typedef long double ld;
typedef pair<int,int> PII;
typedef pair<ll,int> Pli;
typedef pair<ll,ll> Pll;
typedef vector<int> VI;
typedef vector<PII> VII;
//typedef pair<ll,ll>P;
#define fi first
#define se second
#define MP make_pair
#define pb push_back
#define mem(a,b) memset(a,b,sizeof(a))
#define rep(i,a,b) for(int i=(int)a;i<=(int)b;i++)
#define per(i,a,b) for(int i=(int)a;i>=(int)b;i--)
#define REP(i,n) for(int i=0;i<n;++i)
#define lowbit(x) x&(-x)
#define Rand (rand()*(1<<16)+rand())
#define id(x) ((x)<=B?(x):m-n/(x)+1)
#define fors(i) for(auto i:e[x]) if(i!=p)
#define ls p<<1
#define rs p<<1|1

#define FI(n) FastIO::read(n)
#define FO(n) FastIO::write(n)
#define Flush FastIO::Fflush()

const int N=333333;
const int M=666666;
const int MOD=1e9+7;
const int inv2=(MOD+1)/2;
const int intINF=int(1e9);
const ll llINF=ll(2e18);
const uint uintINF=~0U;
const int dx[4]={-1,1,0,0};
const int dy[4]={0,0,-1,1};
const long double pi=acos(-1.0L);
const int eps=0;

int read()
{
   int v=0,f=1;
   char c=getchar();
   while(c<48||57<c) {if(c=='-') f=-1; c=getchar();}
   while(48<=c&&c<=57) v=(v<<3)+v+v+c-48,c=getchar();
   return v*f;
}

ll readll()
{
   ll v=0,f=1;
   char c=getchar();
   while(c<48||57<c) {if(c=='-') f=-1; c=getchar();}
   while(48<=c&&c<=57) v=(v<<3)+v+v+c-48,c=getchar();
   return v*f;
}

/*void pr128(__int128 x)
{
    if(x<0) putchar('-'),x=-x;
    if(x<10) return putchar('0'+x),void();
    pr128(x/10),putchar('0'+(x%10));
}*/

ll dp[222222][3][2][2];
int a[222222],n;

void predo()
{
}

void init()
{
    n=read();
    rep(i,1,n) a[i]=read();
}

void umax(ll &x,ll y)
{
    if(x<y) x=y;
}

void solve()
{
    if(n==1)
    {
        printf("%d\n",a[1]);
        return;
    }
    rep(i,1,n)
     rep(j,0,2)
      rep(x,0,1)
       rep(y,0,1) dp[i][j][x][y]=-llINF;
    dp[1][2][0][0]=-a[1];
    dp[1][1][1][0]=a[1];
    rep(i,1,n-1)
     rep(j,0,2)
      rep(x,0,1)
       rep(y,0,1)
       {
           umax(dp[i+1][(j+2)%3][0][y|(x==0)],dp[i][j][x][y]-a[i+1]);
           umax(dp[i+1][(j+1)%3][1][y|(x==1)],dp[i][j][x][y]+a[i+1]);
       }
    ll ans=max(dp[n][1][0][1],dp[n][1][1][1]);
    printf("%lld\n",ans);
}

int main()
{
    //freopen("1.in","r",stdin);
    //freopen("1.out","w",stdout);
    predo();
    //int cas=read();
    int cas=1;
    while(cas--)
    {
        init();
        solve();
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long uLL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pLL;
typedef pair<double, double> pdd;
const int N = 2e5 + 5;
const int M = 8e5 + 5;
const LL inf = 1e17;

LL read() {
    LL x = 0, t = 1;
    char ch;
    while (!isdigit(ch = getchar())) if (ch == '-') t = -1;
    while (isdigit(ch)) {
        x = 10 * x + ch - '0';
        ch = getchar();
    }
    return x * t;
}

// n + cnt:op=-1 = 1 (mod 3)
LL dp[N][3][2];
LL a[N];

int main() {
    int n = read();
    for (int i = 1; i <= n; i++) a[i] = read();
    for (int i = 1; i <= n; i++)
        for (int j = 0; j < 3; j++)
            for (int k = 0; k < 2; k++)
                dp[i][j][k] = -inf;
    if (n == 1) return 0 * printf("%lld\n", a[1]);
    dp[1][1][0] = -a[1];//写法2： j表示 -1的个数 取模3 ， k 表示 该串是否为 1 -1 1 -1 1 ...
    dp[1][0][1] = a[1];
    for (int i = 2; i <= n; i++) {
        for (int j = 0; j < 3; j++) {
            if (i & 1) {
                dp[i][j][1] = dp[i - 1][j][1] + a[i];
                dp[i][j][0] = dp[i - 1][(j + 2) % 3][1] - a[i];
            } else {
                dp[i][j][1] = dp[i - 1][(j + 2) % 3][1] - a[i];
                dp[i][j][0] = dp[i - 1][j][1] + a[i];
            }
            dp[i][j][0] = max(dp[i][j][0], dp[i - 1][j][0] + a[i]);
            dp[i][j][0] = max(dp[i][j][0], dp[i - 1][(j + 2) % 3][0] - a[i]);
        }
    }
    printf("%lld\n", dp[n][((1 - n) % 3 + 3) % 3][0]);
    return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define m_p make_pair
#define pii pair<int, int>
#define fi first
#define se second
typedef long long ll;
using namespace std;
const int maxn = 2e5+100;
const int mod = 3;
ll dp[maxn][5][2][2];//第i位 -1个数为j（mod 3） 是否有连续 当前符号位
int n;
int a[maxn];
int main()
{
    scanf("%d",&n);
    for(int i = 1;i<=n;i++) scanf("%d",a+i);
    	if(n==1){
    		printf("%d\n",a[1] );
    		return 0;
    	}
	for(int i = 1;i<=n;i++)
		for(int j = 0;j<3;j++)
			for(int k = 0;k<2;k++)
				dp[i][j][k][0] = dp[i][j][k][1] = -1e18;
	dp[1][1][0][1] = -a[1];
	dp[1][0][0][0] = a[1];
	ll res = -1e18;
	for(int i = 1;i<n;i++){
		for(int j = 0;j<3;j++){
			for(int k = 0;k<2;k++){
				for(int l = 0;l<2;l++){
					if(dp[i][j][k][l]==-1e18) continue;
					dp[i+1][(j+1)%mod][k|(l==1)][1] = max(dp[i+1][(j+1)%mod][k|(l==1)][1],dp[i][j][k][l]-a[i+1]);
					dp[i+1][j][k|(l==0)][0] = max(dp[i+1][j][k|(l==0)][0],dp[i][j][k][l]+a[i+1]);
				}
			}
		}
	}
		res = max(res,dp[n][((1-n)%3+3)%3][1][0]);
		res = max(res,dp[n][((1-n)%3+3)%3][1][1]);
		printf("%lld\n",res);

    return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define m_p make_pair
#define pii pair<int, int>
#define fi first
#define se second
typedef long long ll;
using namespace std;
const int maxn = 2e5+100;
const int mod = 3;
ll dp[maxn][5][2][2];//第i位 -1个数为j（mod 3） 是否有连续 当前符号位
int n;
int a[maxn];
int main()
{
    scanf("%d",&n);
    for(int i = 1;i<=n;i++) scanf("%d",a+i);
	for(int i = 1;i<=n;i++)
		for(int j = 0;j<3;j++)
			for(int k = 0;k<2;k++)
				dp[i][j][k][0] = dp[i][j][k][1] = -1e18;
	dp[1][1][0][1] = -a[1];
	dp[1][0][0][0] = a[1];
	ll res = 0;
	for(int i = 1;i<n;i++){
		for(int j = 0;j<3;j++){
			for(int k = 0;k<2;k++){
				for(int l = 0;l<2;l++){
					if(dp[i][j][k][l]==-1e18) continue;
					dp[i+1][(j+1)%mod][k|(l==1)][1] = max(dp[i+1][(j+1)%mod][k|(l==1)][1],dp[i][j][k][l]-a[i+1]);
					dp[i+1][j][k|(l==0)][0] = max(dp[i+1][j][k|(l==0)][0],dp[i][j][k][l]+a[i+1]);
				}
			}
		}
	}
		res = max(res,dp[n][((1-n)%3+3)%3][1][0]);
		res = max(res,dp[n][((1-n)%3+3)%3][1][1]);
		printf("%lld\n",res);

    return 0;
}


#include "bits/stdc++.h"

using namespace std;

typedef unsigned long long ULL;
typedef long long LL;
typedef pair<int, int> pr;
typedef pair<LL, LL> lpr;
typedef pair<double, double> dpr;
typedef pair<long double, long double> ldpr;
typedef double db;
typedef long double ld;
// typedef complex<double> cp;

#define dbgs(x) #x << " = " << x
#define dbgs2(x, y) dbgs(x) << ", " << dbgs(y)
#define dbgs3(x, y, z) dbgs2(x, y) << ", " << dbgs(z)
#define dbgs4(w, x, y, z) dbgs3(w, x, y) << ", " << dbgs(z)

#define mst(s, x) memset(s, x, sizeof(s))
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define mp make_pair
#define all(x) x.begin(), x.end()
#define unq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define rg register
#define fp(i, a, b) for (rg int i = (a), I = (b) + 1; i < I; ++i)
#define fd(i, a, b) for (rg int i = (a), I = (b)-1; i > I; --i)
#define ub upper_bound
#define lb lower_bound
#define bitcount __builtin_popcount
#define sqr(x) ((x)*(x))

#define go(u) for (rg int i = pre[u], v = e[i].v; i; i = e[i].next, v = e[i].v)
#define gow(u) for (rg LL i = pre[u], v = e[i].v, w = e[i].w; i; i = e[i].next, v = e[i].v, w = e[i].w)
#define EDGE(N,M) struct edge{int u,v,w,next;}e[M];int pre[N],edge_cnt=0;void addedge(int u,int v,int w=0){edge_cnt=edge_cnt+1,e[edge_cnt].u=u,e[edge_cnt].v=v,e[edge_cnt].w=w,e[edge_cnt].next=pre[u],pre[u]=edge_cnt;}
#define CLEAR_EDGE(N) {edge_cnt=0,memset(pre,0,sizeof(int)*(N+1));}

#define MC int _CASE;scanf("%d",&_CASE);fp(case_num,1,_CASE)

const int next_x[8] = {0, 1, -1, 0, 1, 1, -1, -1};
const int next_y[8] = {1, 0, 0, -1, 1, -1, -1, 1};
const int inf = 1e9+5;//7;
const LL linf = 1e18+5;
const db  PI  = acos(-1.0);
// const db  eps = 1e-8;

const int MAXN = 2e5+5;
// const int M    = 4e5+5;

#define mid ((l+r)/2)
// #define ls (cnt<<1)
// #define rs (cnt<<1|1)

// #define ls(x) ch[x][0]
// #define rs(x) ch[x][1]

/*----------head----------*/

// set<set<int>> ans;
// set<int> merge(set<int> a,set<int> b)
// {
//     set<int> temp;
//     for(auto x:a)temp.insert(-x);
//     for(auto x:b)temp.insert(-x);
//     return temp;
// }
// void dfs(vector<set<int>> cur)
// {
//     if(cur.size()==1)
//     {
//         ans.insert(cur[0]);
//         return;
//     }
//     int n=cur.size();
//     fp(i,0,n-2)
//     {
//         vector<set<int>> temp;
//         fp(j,0,i-1)temp.pb(cur[j]);
//         temp.pb(merge(cur[i],cur[i+1]));
//         fp(j,i+2,n-1)temp.pb(cur[j]);
//         dfs(temp);
//     }
// }
// void solve(int n)
// {
//     cout << dbgs(n) << endl;

//     ans.clear();
//     vector<set<int>> s;
//     fp(i,1,n)s.pb({i});
//     dfs(s);
//     cout << dbgs(ans.size()) << endl;

//     vector<vector<int>> ve[100];
//     for(auto s:ans)
//     {
//         vector<int> v;
//         for(auto x:s)v.pb(x);
//         sort(all(v),[](int a,int b)
//         {
//             return abs(a)<abs(b);
//         });
//         int cnt=0;
//         for(auto x:v)
//         {
//             printf("%d",(x>=0));
//             if(x<0)++cnt;
//         }
//         printf("\n");
//         ve[cnt].pb(v);
//     }
//     fp(i,0,n)if(ve[i].size())
//         cout << dbgs2(i,ve[i].size()) << endl;
// }
// int work()
// {
//     fp(i,1,10)solve(i),cout << endl;
//     // solve(5);
//     // solve(3);
//     // solve(7);
//     return 0;
// }

// numbers of allowed negative numbers for given n
// 1 -1 1 -1 1 -1 ... is banned
// n=1  0
// n=2  2
// n=3  1

// n=4  0 3
// n=5  2 5
// n=6  1 4

// n=7  0 3 6
// n=8  2 5 8
// n=9  1 4 7

// n=10 0 3 6 9
// n=11 2 5 8 11
// n=12 1 4 7 10

// n%3 to find regular pattern
int n;
vector<pr> v;
LL sum=0,ans=-linf;
bool vis[MAXN];
bool check()
{
    if(n==1)return 0;
    bool flag=1;
    for(int i=2;i<=n;i+=2)
        flag&=(vis[i]);
    return flag;
}
int work()
{
    scanf("%d",&n);
    fp(i,1,n)
    {
        int x;scanf("%d",&x);
        v.pb({x,i}),sum+=x;
    }

    sort(all(v));
    int pos,t=n%3;
    if(t==1)pos=0;
    if(t==2)pos=2;
    if(t==0)pos=1;
    fp(i,0,n)
    {
        int x=i?v[i-1].fi:0;
        sum-=2*x;
        if(i)vis[v[i-1].se]=1;
        if(i==pos)
        {
            if(i==n/2&&check())ans=max(ans,sum+2*x-2*v[i].fi);
            else ans=max(ans,sum);
            pos+=3;
        }
    }
    return printf("%lld\n",ans);
}

// if(!x*y) 注意爆int
// 少码大数据结构，想想复杂度更优的做法
// 小数 二分/三分 注意break条件
// 浮点运算 sqrt(a^2-b^2) 可用 sqrt(a+b)*sqrt(a-b) 代替，避免精度问题
// long double -> %Lf 别用C11 (C14/16)
// 控制位数 cout << setprecision(10) << ans;
// reverse vector 注意判空 不然会re
// 分块注意维护块上标记 来更新块内数组a[]
// vector+lower_bound常数 < map/set/(unordered_map)
// map.find不会创建新元素 map[]会 注意空间
// 别对指针用memset
// 用位运算表示2^n注意加LL 1LL<<20
// 注意递归爆栈
// 注意边界
// 注意memset 多组会T

//#define ONLINE_JUDGE

int main()
{
    // ios::sync_with_stdio(false);
    // cin.tie(0);
#ifdef ONLINE_JUDGE
    // freopen("triatrip.in", "r",stdin );
    // freopen("triatrip.out","w",stdout);
#endif // ONLINE_JUDGE
#ifndef ONLINE_JUDGE
    int size = 512 << 20; // 512MB
    char *p = (char*)malloc(size) + size;
    __asm__("movl %0, %%esp\n" :: "r"(p));
    freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
#endif
    // make();
    work();
#ifndef ONLINE_JUDGE
    cout << "time:" << clock() << "ms" << endl;
    freopen("CON", "r", stdin);
    freopen("CON", "w", stdout);
    system("pause");
    fflush(stdout);
#endif
    return 0;
}


#include "bits/stdc++.h"

using namespace std;

typedef unsigned long long ULL;
typedef long long LL;
typedef pair<int, int> pr;
typedef pair<LL, LL> lpr;
typedef pair<double, double> dpr;
typedef pair<long double, long double> ldpr;
typedef double db;
typedef long double ld;
// typedef complex<double> cp;

#define dbgs(x) #x << " = " << x
#define dbgs2(x, y) dbgs(x) << ", " << dbgs(y)
#define dbgs3(x, y, z) dbgs2(x, y) << ", " << dbgs(z)
#define dbgs4(w, x, y, z) dbgs3(w, x, y) << ", " << dbgs(z)

#define mst(s, x) memset(s, x, sizeof(s))
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define mp make_pair
#define all(x) x.begin(), x.end()
#define unq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define rg register
#define fp(i, a, b) for (rg int i = (a), I = (b) + 1; i < I; ++i)
#define fd(i, a, b) for (rg int i = (a), I = (b)-1; i > I; --i)
#define ub upper_bound
#define lb lower_bound
#define bitcount __builtin_popcount
#define sqr(x) ((x)*(x))

#define go(u) for (rg int i = pre[u], v = e[i].v; i; i = e[i].next, v = e[i].v)
#define gow(u) for (rg LL i = pre[u], v = e[i].v, w = e[i].w; i; i = e[i].next, v = e[i].v, w = e[i].w)
#define EDGE(N,M) struct edge{int u,v,w,next;}e[M];int pre[N],edge_cnt=0;void addedge(int u,int v,int w=0){edge_cnt=edge_cnt+1,e[edge_cnt].u=u,e[edge_cnt].v=v,e[edge_cnt].w=w,e[edge_cnt].next=pre[u],pre[u]=edge_cnt;}
#define CLEAR_EDGE(N) {edge_cnt=0,memset(pre,0,sizeof(int)*(N+1));}

#define MC int _CASE;scanf("%d",&_CASE);fp(case_num,1,_CASE)

const int next_x[8] = {0, 1, -1, 0, 1, 1, -1, -1};
const int next_y[8] = {1, 0, 0, -1, 1, -1, -1, 1};
const int inf = 1e9+5;//7;
const LL linf = 1e18+5;
const db  PI  = acos(-1.0);
// const db  eps = 1e-8;

const int MAXN = 2e5+5;
// const int M    = 4e5+5;

#define mid ((l+r)/2)
// #define ls (cnt<<1)
// #define rs (cnt<<1|1)

// #define ls(x) ch[x][0]
// #define rs(x) ch[x][1]

/*----------head----------*/

// set<set<int>> ans;
// set<int> merge(set<int> a,set<int> b)
// {
//     set<int> temp;
//     for(auto x:a)temp.insert(-x);
//     for(auto x:b)temp.insert(-x);
//     return temp;
// }
// void dfs(vector<set<int>> cur)
// {
//     if(cur.size()==1)
//     {
//         ans.insert(cur[0]);
//         return;
//     }
//     int n=cur.size();
//     fp(i,0,n-2)
//     {
//         vector<set<int>> temp;
//         fp(j,0,i-1)temp.pb(cur[j]);
//         temp.pb(merge(cur[i],cur[i+1]));
//         fp(j,i+2,n-1)temp.pb(cur[j]);
//         dfs(temp);
//     }
// }
// void solve(int n)
// {
//     cout << dbgs(n) << endl;

//     ans.clear();
//     vector<set<int>> s;
//     fp(i,1,n)s.pb({i});
//     dfs(s);
//     cout << dbgs(ans.size()) << endl;

//     vector<vector<int>> ve[100];
//     for(auto s:ans)
//     {
//         vector<int> v;
//         for(auto x:s)v.pb(x);
//         sort(all(v),[](int a,int b)
//         {
//             return abs(a)<abs(b);
//         });
//         int cnt=0;
//         for(auto x:v)
//         {
//             printf("%d",(x>=0));
//             if(x<0)++cnt;
//         }
//         printf("\n");
//         ve[cnt].pb(v);
//     }
//     fp(i,0,n)if(ve[i].size())
//         cout << dbgs2(i,ve[i].size()) << endl;
// }
// int work()
// {
//     fp(i,1,10)solve(i),cout << endl;
//     // solve(5);
//     // solve(3);
//     // solve(7);
//     return 0;
// }

// 1 -1 1 -1 1 -1 ... is banned
// n=1  0
// n=2  2
// n=3  1

// n=4  0 3
// n=5  2 5
// n=6  1 4

// n=7  0 3 6
// n=8  2 5 8
// n=9  1 4 7

// n=10 0 3 6 9
// n=11 2 5 8 11
// n=12 1 4 7 10

// n%3 to find regular pattern
int n;
vector<pr> v;
LL sum=0,ans=-linf;
bool vis[MAXN];
bool check()
{
    if(n==1)return 0;
    bool flag=1;
    for(int i=2;i<=n;i+=2)
        flag&=(vis[i]);
    return flag;
}
int work()
{
    scanf("%d",&n);
    fp(i,1,n)
    {
        int x;scanf("%d",&x);
        v.pb({x,i}),sum+=x;
    }
    sort(all(v));
    int pos,t=n%3;
    if(t==1)pos=0;
    if(t==2)pos=2;
    if(t==0)pos=1;
    fp(i,0,n)
    {
        int x=i?v[i-1].fi:0;
        sum-=2*x;
        if(i)vis[v[i-1].se]=1;
        if(i==pos)
        {
            if(i==n/2&&check())ans=max(ans,sum+2*x-2*v[i].fi);
            else ans=max(ans,sum);
            pos+=3;
        }
    }
    return printf("%lld\n",ans);
}

// if(!x*y) 注意爆int
// 少码大数据结构，想想复杂度更优的做法
// 小数 二分/三分 注意break条件
// 浮点运算 sqrt(a^2-b^2) 可用 sqrt(a+b)*sqrt(a-b) 代替，避免精度问题
// long double -> %Lf 别用C11 (C14/16)
// 控制位数 cout << setprecision(10) << ans;
// reverse vector 注意判空 不然会re
// 分块注意维护块上标记 来更新块内数组a[]
// vector+lower_bound常数 < map/set/(unordered_map)
// map.find不会创建新元素 map[]会 注意空间
// 别对指针用memset
// 用位运算表示2^n注意加LL 1LL<<20
// 注意递归爆栈
// 注意边界
// 注意memset 多组会T

//#define ONLINE_JUDGE

int main()
{
    // ios::sync_with_stdio(false);
    // cin.tie(0);
#ifdef ONLINE_JUDGE
    // freopen("triatrip.in", "r",stdin );
    // freopen("triatrip.out","w",stdout);
#endif // ONLINE_JUDGE
#ifndef ONLINE_JUDGE
    int size = 512 << 20; // 512MB
    char *p = (char*)malloc(size) + size;
    __asm__("movl %0, %%esp\n" :: "r"(p));
    freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
#endif
    // make();
    work();
#ifndef ONLINE_JUDGE
    cout << "time:" << clock() << "ms" << endl;
    freopen("CON", "r", stdin);
    freopen("CON", "w", stdout);
    system("pause");
    fflush(stdout);
#endif
    return 0;
}


#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <queue>
#include <stdio.h>
#include <math.h>
#include <assert.h>
#include <string.h>
#include <numeric>
#include <unordered_map>
using namespace std;

#define ll long long
#define ld double
#define endl "\n"
const int MX = 200005;
const int LG = log2(MX) + 2;
const int mod = 1000000007;
const int inf = 2000000069;
const ll infll = 1000000000000000069ll;
const ll inv2 = (mod + 1) / 2;
#define max(x, y) (x > y ? x : y)
#define min(x, y) (x < y ? x : y)

ll pw(ll b, ll e, ll m = mod){
	ll r = 1ll;
	for(; e > 0; e /= 2, b = (b * b) % m)
		if(e % 2) r = (r * b) % m;
	return r;
}

int n, arr[MX];
ll dp[MX][2][3];

int main(){
	cin.tie(0) -> sync_with_stdio(0);

	cin >> n;
	for(int i = 1; i <= n; i ++)
		cin >> arr[i];

	if(n == 1){
		cout << arr[1] << endl;
		return 0;
	}

	for(int i = 0; i <= n; i ++) for(int j = 0; j < 2; j ++) for(int k = 0; k < 3; k ++)
		dp[i][j][k] = -infll;

	dp[0][0][0] = 0;
	for(int i = 1; i <= n; i ++){
		for(int b = 0; b < 3; b ++){
			for(int a = 0; a < 2; a ++)
				dp[i][a][b] = max(dp[i - 1][a][b] - arr[i], dp[i - 1][a][(b + 2) % 3] + arr[i]);
			if(i >= 2)
				dp[i][1][b] = max(dp[i][1][b], max(dp[i - 2][0][b] - arr[i] - arr[i - 1], dp[i - 2][0][(b + 1) % 3] + arr[i - 1] + arr[i]));
		}
	}

	if(n % 2)
		cout << dp[n][1][((n + 1) / 2) % 3] << endl;
	else
		cout << dp[n][1][((n / 2) - 1) % 3] << endl;

	return 0;
}


#include<bits/stdc++.h>
#define rep(i,a,b) for (int i = (a); i <= (b); ++i)
#define il inline
#define LL long long
using namespace std;
il LL read() {
	LL x = 0,y = 1; char ch = getchar(); while (!isdigit(ch)) {if (ch == '-') y = -y; ch = getchar();}
	while (isdigit(ch)) {x = x*10+ch-'0'; ch = getchar();} return x*y;
}
namespace qiqi {
	const int N = 2e5+5; int n; LL a[N],f[N][3][2];
	void main() {
		n = read(); rep(i,0,2) f[0][i][1] = -1e18; rep(i,1,n) a[i] = read();
		rep(i,1,n) rep(j,0,2) {
			rep(k,0,1) f[i][j][k] = max(f[i-1][(j+2)%3][k]+a[i],f[i-1][(j+1)%3][k]-a[i]);
			if (i > 1) f[i][j][1] = max(f[i][j][1],max(f[i-2][(j+1)%3][0]+a[i]+a[i-1],f[i-2][(j+2)%3][0]-a[i]-a[i-1]));
		}
		printf("%lld\n",f[n][1][1]);
	}
}
int main() {
	qiqi::main(); return 0;
}


#include <iostream>
#include <cstdio>
#include <limits.h>
#include <cmath>
#include <cstdlib>
#include <cstring>
using namespace std;
int main()
{
    int cnt, n, i;
    bool f;
    long long x, y, tmp1, tmp2;
    cin>>x;
    y = x;
    if(x == 1)
    {
       cout<<1<<endl<<0<<endl;
        return 0;
    }
    n = ceil(sqrt(x));
    //cout<<n<<endl;
    cnt = 0;
    tmp1 = tmp2 = 1;
    for(i = 2; i <= n; i++)
    {
        while(x % i == 0 && x != 1)
        {
            //cout<<i<<endl;
            cnt++;
            f = true;
            x /= i;
            if(tmp1 == 1)
                tmp1 = i;
            else
                if(tmp2 == 1)
                    tmp2 = i;
        }
    }
    //cout<<cnt<<endl;
    x = y;
    if(cnt <= 1)
    {
        cout<<1<<endl<<0<<endl;
        return 0;
    }
    if(cnt >= 3)
    {
        cout<<1<<endl;
        cout<<tmp1 * tmp2<<endl;
    }
    else
    {
        cout<<2<<endl;
    }

    return 0;
}


#include <iostream>
#include <cstdio>
#include <limits.h>
#include <cmath>
#include <cstdlib>
#include <cstring>
using namespace std;
int main()
{
    int cnt, n, tmp, i;
    bool f;
    long long x, y;
    cin>>x;
    y = x;
    if(x == 1)
    {
       cout<<1<<endl<<0<<endl;
        return 0;
    }
    n = sqrt(x);
    cnt = 1;
    tmp = 1;
    for(i = 2; i <= n; i++)
    {
        while(x % i == 0)
        {
            cnt++;
            f = true;
            x /= i;
            if(tmp == 1)
                tmp = i;
        }
    }
    x = y;
    if(cnt == 1)
    {
        cout<<1<<endl<<0<<endl;
        return 0;
    }
    if(cnt > 3)
    {
        cout<<1<<endl;
        cout<<x/tmp<<endl;
    }
    else
    {
        cout<<2<<endl;
    }

    return 0;
}


#include <iostream>
#include <cstdio>
#include <limits.h>
#include <cmath>
#include <cstdlib>
#include <cstring>
using namespace std;
int main()
{
    int cnt, n, tmp, i;
    bool f;
    long long x, y;
    cin>>x;
    y = x;
    if(x == 1)
    {
       cout<<1<<endl<<0<<endl;
        return 0;
    }
    n = sqrt(x);
    cnt = 1;
    tmp = 1;
    for(i = 2; i <= n; i++)
    {
        while(x % i == 0)
        {
            cnt++;
            f = true;
            x /= i;
            if(tmp == 1)
                tmp = i;
        }
    }
    x = y;
    if(cnt > 3)
    {
        cout<<1<<endl;
        cout<<x / tmp<<endl;
    }
    else
    {
        cout<<2<<endl;
    }

    return 0;
}


#include <iostream>
#include <cstdio>
#include <limits.h>
#include <cmath>
#include <cstdlib>
#include <cstring>
using namespace std;
int main()
{
    int cnt, n, i;
    bool f;
    long long x, y, tmp1, tmp2;
    cin>>x;
    y = x;
    if(x == 1)
    {
       cout<<1<<endl<<0<<endl;
        return 0;
    }
    n = sqrt(x);
    cnt = 1;
    tmp1 = tmp2 = 1;
    for(i = 2; i <= n; i++)
    {
        while(x % i == 0)
        {
            cnt++;
            f = true;
            x /= i;
            if(tmp1 == 1)
                tmp1 = i;
            else
                if(tmp2 == 1)
                    tmp2 = i;
        }
    }
    x = y;
    if(cnt <= 1)
    {
        cout<<1<<endl<<0<<endl;
        return 0;
    }
    if(cnt >= 3)
    {
        cout<<1<<endl;
        cout<<tmp1 * tmp2<<endl;
    }
    else
    {
        cout<<2<<endl;
    }

    return 0;
}


#include <iostream>
#include <cstdio>
#include <limits.h>
#include <cmath>
#include <cstdlib>
#include <cstring>
using namespace std;
int main()
{
    int cnt, n, i;
    bool f;
    long long x, y, tmp1, tmp2;
    cin>>x;
    y = x;
    if(x == 1)
    {
       cout<<1<<endl<<0<<endl;
        return 0;
    }
    n = sqrt(x);
    cnt = 0;
    tmp1 = tmp2 = 1;
    for(i = 2; i <= n; i++)
    {
        while(x % i == 0 && x != 1)
        {
            cout<<i<<endl;
            cnt++;
            f = true;
            x /= i;
            if(tmp1 == 1)
                tmp1 = i;
            else
                if(tmp2 == 1)
                    tmp2 = i;
        }
    }
    //cout<<cnt<<endl;
    x = y;
    if(cnt <= 1)
    {
        cout<<1<<endl<<0<<endl;
        return 0;
    }
    if(cnt >= 3)
    {
        cout<<1<<endl;
        cout<<tmp1 * tmp2<<endl;
    }
    else
    {
        cout<<2<<endl;
    }

    return 0;
}


#include <iostream>
#include <cstdio>
#include <limits.h>
#include <cmath>
#include <cstdlib>
#include <cstring>
using namespace std;
int main()
{
    int cnt, n, tmp, i;
    bool f;
    long long x, y;
    cin>>x;
    y = x;
    if(x == 1)
    {
       cout<<1<<endl<<0<<endl;
        return 0;
    }
    n = sqrt(x);
    cnt = 1;
    tmp = 1;
    for(i = 2; i <= n; i++)
    {
        while(x % i == 0)
        {
            cnt++;
            f = true;
            x /= i;
            if(tmp == 1)
                tmp = i;
        }
    }
    x = y;
    if(cnt <= 1)
    {
        cout<<1<<endl<<0<<endl;
        return 0;
    }
    if(cnt >= 3)
    {
        cout<<1<<endl;
        cout<<x/tmp<<endl;
    }
    else
    {
        cout<<2<<endl;
    }

    return 0;
}


#include <iostream>
#include <cstdio>
#include <limits.h>
#include <cmath>
#include <cstdlib>
#include <cstring>
using namespace std;
int main()
{
    int cnt, n, i;
    bool f;
    long long x, y, tmp1, tmp2;
    cin>>x;
    y = x;
    if(x == 1)
    {
       cout<<1<<endl<<0<<endl;
        return 0;
    }
    n = ceil(sqrt(x));
    cout<<n<<endl;
    cnt = 0;
    tmp1 = tmp2 = 1;
    for(i = 2; i <= n; i++)
    {
        while(x % i == 0 && x != 1)
        {

            cnt++;
            //cout<<cnt<<endl;
            f = true;
            x /= i;
            //cout<<x<<","<<i<<endl;
            if(tmp1 == 1)
                tmp1 = i;
            else
                if(tmp2 == 1)
                    tmp2 = i;
        }
    }
    if(x != 1)
    {
        cnt ++;
    }
    //cout<<cnt<<endl;
    x = y;
    if(cnt <= 1)
    {
        cout<<1<<endl<<0<<endl;
        return 0;
    }
    if(cnt >= 3)
    {
        cout<<1<<endl;
        cout<<tmp1 * tmp2<<endl;
    }
    else
    {
        cout<<2<<endl;
    }

    return 0;
}


#include <iostream>
#include <cstdio>
#include <limits.h>
#include <cmath>
#include <cstdlib>
#include <cstring>
using namespace std;
int main()
{
    int cnt, n, i;
    bool f;
    long long x, y, tmp1, tmp2;
    cin>>x;
    y = x;
    if(x == 1)
    {
       cout<<1<<endl<<0<<endl;
        return 0;
    }
    n = sqrt(x);
    cnt = 0;
    tmp1 = tmp2 = 1;
    for(i = 2; i <= n; i++)
    {
        while(x % i == 0 && x != 1)
        {
            //cout<<i<<endl;
            cnt++;
            f = true;
            x /= i;
            if(tmp1 == 1)
                tmp1 = i;
            else
                if(tmp2 == 1)
                    tmp2 = i;
        }
    }
    //cout<<cnt<<endl;
    x = y;
    if(cnt <= 1)
    {
        cout<<1<<endl<<0<<endl;
        return 0;
    }
    if(cnt >= 3)
    {
        cout<<1<<endl;
        cout<<tmp1 * tmp2<<endl;
    }
    else
    {
        cout<<2<<endl;
    }

    return 0;
}


#include <iostream>
#include <cstdio>
#include <limits.h>
#include <cmath>
#include <cstdlib>
#include <cstring>
using namespace std;
int main()
{
    int cnt, n, i;
    bool f;
    long long x, y, tmp1, tmp2;
    cin>>x;
    y = x;
    if(x == 1)
    {
       cout<<1<<endl<<0<<endl;
        return 0;
    }
    n = ceil(sqrt(x));
    //cout<<n<<endl;
    cnt = 0;
    tmp1 = tmp2 = 1;
    for(i = 2; i <= n; i++)
    {
        while(x % i == 0 && x != 1)
        {

            cnt++;
            //cout<<cnt<<endl;
            f = true;
            x /= i;
            //cout<<x<<","<<i<<endl;
            if(tmp1 == 1)
                tmp1 = i;
            else
                if(tmp2 == 1)
                    tmp2 = i;
        }
    }
    if(x != 1)
    {
        cnt ++;
    }
    //cout<<cnt<<endl;
    x = y;
    if(cnt <= 1)
    {
        cout<<1<<endl<<0<<endl;
        return 0;
    }
    if(cnt >= 3)
    {
        cout<<1<<endl;
        cout<<tmp1 * tmp2<<endl;
    }
    else
    {
        cout<<2<<endl;
    }

    return 0;
}


#include<iostream>
using namespace std;
int main()
{
    long long q,q1;
    while(cin>>q)
    {
        q1 = q;
        bool flag = false;
        for(long long i=2; i*i<q; i++)
        {
            if(q%i == 0)
            {
                q/=i;
                flag = true;
                break;
            }
        }
        if(flag == false)
        {
            cout<<"1"<<endl<<"0"<<endl;;
            return 0;
        }
        flag = false;
        //cout<<"q="<<q<<endl;
        //system("pause");
        for(long long i=2; i*i<q; i++)
        {
            if(q%i == 0)
            {
                q/=i;
                cout<<"1"<<endl<<q1/q<<endl;
                return 0;
            }
        }
        cout<<"2"<<endl;

    }
    return 0;
}


#include<iostream>
#include<cstdlib>
#include<vector>
#include<map>
#include<cstring>
#include<string>
#include<algorithm>
#include<ctype.h>
#include<fstream>
#include<string.h>
#include<stdio.h>
#include<math.h>
#include<stack>
#include<queue>
#include<ctime>
#include<conio.h>
using namespace std;

const int INF=0x7FFFFFFF;
const double eps=1e-10;
const double pi=acos(-1.0);

#define S(a) scanf("%d",&a)
#define SS(a,b) scanf("%d%d",&a,&b)
#define SSS(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define P(a) printf("%d\n", a)
#define PP(a,b) printf("%d %d\n",a,b)
#define PPP(a,b,c) printf("%d %d %d\n",a,b,c)
#define chmin(a,b) ((a)<(b)?(a):(b))
#define chmax(a,b) ((a)>(b)?(a):(b))

template<class T> inline T gcd(T a,T b)//NOTES:gcd(
  {if(a<0)return gcd(-a,b);if(b<0)return gcd(a,-b);return (b==0)?a:gcd(b,a%b);}
template<class T> inline T lcm(T a,T b)//NOTES:lcm(
  {if(a<0)return lcm(-a,b);if(b<0)return lcm(a,-b);return a*(b/gcd(a,b));}

typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef long long LL;
int dir_4[4][2]={{0,1},{-1,0},{0,-1},{1,0}};
int dir_8[8][2]={{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1},{1,0},{1,1}};
//�£����£������ϣ��ϣ����ϣ��ң����¡�

/*
typedef struct
{
    bool data;
    long long connect;
}
*/

const long long MAX=1000005;

bool data[MAX];
long long connect[MAX];

int main()
{
    memset(data,false,sizeof(data));
    memset(connect,0,sizeof(connect));
    for(int i=2; i<sqrt(MAX); i++)
    {
        if(data[i] == false)
        for(int j=i; i*j<MAX; j++)
        {
            data[i*j] = true;
        }
    }
/*
    for(int i=1; i<100; i++)
    if(data[i] == false)
    cout<<i<<" ";
    cout<<endl;
    system("pause");
*/
    for(int i=1; i<MAX/2; i++)
    {
        if(data[i] == true)
        {
            for(int j=2; i*j<MAX; j++)
            {
                if(data[i*j] == true)
                {
                    data[i*j] = false;
                    connect[i*j] = i;
                }
            }
        }
    }

    long long A;
    while(cin>>A)
    {
        if(data[A] == false)
        cout<<"1"<<endl<<connect[A]<<endl;
        else cout<<"2"<<endl;
    }
}


#include<iostream>
using namespace std;
int main()
{
    long long q,q1;
    while(cin>>q)
    {
        q1 = q;
        bool flag = false;
        for(long long i=2; i*i<=q; i++)
        {
            if(q%i == 0)
            {
                q/=i;
                flag = true;
                break;
            }
        }
        if(flag == false)
        {
            cout<<"1"<<endl<<"0"<<endl;;
            return 0;
        }
        flag = false;
        //cout<<"q="<<q<<endl;
        //system("pause");
        for(long long i=2; i*i<=q; i++)
        {
            if(q%i == 0)
            {
                q/=i;
                cout<<"1"<<endl<<q1/q<<endl;
                return 0;
            }
        }
        cout<<"2"<<endl;

    }
    return 0;
}


#include<iostream>
#include<cstdlib>
#include<vector>
#include<map>
#include<cstring>
#include<string>
#include<algorithm>
#include<ctype.h>
#include<fstream>
#include<string.h>
#include<stdio.h>
#include<math.h>
#include<stack>
#include<queue>
#include<ctime>
#include<conio.h>
using namespace std;

const int INF=0x7FFFFFFF;
const double eps=1e-10;
const double pi=acos(-1.0);

#define S(a) scanf("%d",&a)
#define SS(a,b) scanf("%d%d",&a,&b)
#define SSS(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define P(a) printf("%d\n", a)
#define PP(a,b) printf("%d %d\n",a,b)
#define PPP(a,b,c) printf("%d %d %d\n",a,b,c)
#define chmin(a,b) ((a)<(b)?(a):(b))
#define chmax(a,b) ((a)>(b)?(a):(b))

template<class T> inline T gcd(T a,T b)//NOTES:gcd(
  {if(a<0)return gcd(-a,b);if(b<0)return gcd(a,-b);return (b==0)?a:gcd(b,a%b);}
template<class T> inline T lcm(T a,T b)//NOTES:lcm(
  {if(a<0)return lcm(-a,b);if(b<0)return lcm(a,-b);return a*(b/gcd(a,b));}

typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef long long LL;
int dir_4[4][2]={{0,1},{-1,0},{0,-1},{1,0}};
int dir_8[8][2]={{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1},{1,0},{1,1}};
//�£����£������ϣ��ϣ����ϣ��ң����¡�

/*
typedef struct
{
    bool data;
    long long connect;
}
*/

const long long MAX=10000000000005;

bool data[MAX];
long long connect[MAX];

int main()
{
    memset(data,false,sizeof(data));
    memset(connect,0,sizeof(connect));
    for(int i=2; i<sqrt(MAX); i++)
    {
        for(int j=i*i; i*j<MAX; j++)
        {
            data[i] = true;
        }
    }
    for(int i=0; i<MAX/2; i++)
    {
        if(data[i] == true)
        {
            for(int j=2; i*j<MAX; j++)
            {
                if(data[j]==true)
                {
                    data[i*j] = false;
                    connect[i*j] = i;
                }
            }
        }
    }
    long long A;
    while(cin>>A)
    {
        cout<<data[A]<<connect[A]<<endl;
    }
}


#include<iostream>
using namespace std;
int main()
{
    int q,q1;
    while(cin>>q)
    {
        q1 = q;
        bool flag = false;
        for(int i=2; i*i<q; i++)
        {
            if(q%i == 0)
            {
                q/=i;
                flag = true;
                break;
            }
        }
        if(flag == false)
        {
            cout<<"1"<<endl;
            return 0;
        }
        flag = false;
        //cout<<"q="<<q<<endl;
        //system("pause");
        for(int i=2; i*i<q; i++)
        {
            if(q%i == 0)
            {
                q/=i;
                cout<<"1"<<endl<<q1/q<<endl;
                return 0;
            }
        }
        cout<<"2"<<endl;

    }
    return 0;
}


#include<iostream>
using namespace std;
int main()
{
    long long q,q1;
    while(cin>>q)
    {
        q1 = q;
        bool flag = false;
        for(int i=2; i*i<q; i++)
        {
            if(q%i == 0)
            {
                q/=i;
                flag = true;
                break;
            }
        }
        if(flag == false)
        {
            cout<<"1"<<endl<<"0"<<endl;;
            return 0;
        }
        flag = false;
        //cout<<"q="<<q<<endl;
        //system("pause");
        for(int i=2; i*i<q; i++)
        {
            if(q%i == 0)
            {
                q/=i;
                cout<<"1"<<endl<<q1/q<<endl;
                return 0;
            }
        }
        cout<<"2"<<endl;

    }
    return 0;
}


#include<iostream>
using namespace std;
int main()
{
    long long q,q1;
    while(cin>>q)
    {
        q1 = q;
        bool flag = false;
        for(int i=2; i*i<q; i++)
        {
            if(q%i == 0)
            {
                q/=i;
                flag = true;
                break;
            }
        }
        if(flag == false)
        {
            cout<<"1"<<endl;
            return 0;
        }
        flag = false;
        //cout<<"q="<<q<<endl;
        //system("pause");
        for(int i=2; i*i<q; i++)
        {
            if(q%i == 0)
            {
                q/=i;
                cout<<"1"<<endl<<q1/q<<endl;
                return 0;
            }
        }
        cout<<"2"<<endl;

    }
    return 0;
}


#include<iostream>
#include<fstream>
#include<sstream>
#include<cstdio>
#include<stdlib.h>
#include<string>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<iomanip>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pa;
typedef vector<int> vi;
typedef vector<ll> vin;
typedef vector<string> vs;
typedef vector<vector<ll> > vvin;
typedef vector<bool> vb;

#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define BREP(i,a,b) for(ll i=a-1;i>=b;i--)
#define brep(i,n) BREP(i,n,0)
#define pb push_back
#define inf 999999999
#define SIZE 10000000
#define mp make_pair
#define sz size()
#define NIL 0
#define DEBUG 0
#define all(vec) (vec).begin(),(vec).end()
#define NEG -1

bool isComposite(ll num) {
	for(ll i=2;i*i<=num;i++)
		if(num%i==0)
			return true;
	return false;
}

int main() {
	ll q,i,fac1=-1,fac2=-1,fax=0;
	cin>>q;
	if(q==1 || q==2 || q==3 || q==5 || q==7) {
		cout<<"1\n0\n";
		return 0;
	}
	//get all factors:
	for(i=2;i*i<=q;i++)
		if(!(q%i)) {
			fax+=2;
			if(fac1==-1)
				fac1=i;
			else if(fac2==-1)
				fac2=i;
		}
	if(fax==0) { //q is prime
		cout<<"1\n0\n";
		return 0;
	}
	if(fax==2) { //q has exactly two prime factors
		cout<<"2\n";
		return 0;
	}
	cout<<"1\n";
	if(!isComposite(fac1) && !isComposite(fac2))
		cout<<fac2*fac1<<"\n";
	else if(isComposite(fac1))
		cout<<fac1<<"\n";
	else
		cout<<fac2<<"\n";
	return 0;
}


#include<iostream>
#include<fstream>
#include<sstream>
#include<cstdio>
#include<stdlib.h>
#include<string>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<iomanip>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pa;
typedef vector<int> vi;
typedef vector<ll> vin;
typedef vector<string> vs;
typedef vector<vector<ll> > vvin;
typedef vector<bool> vb;

#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define BREP(i,a,b) for(ll i=a-1;i>=b;i--)
#define brep(i,n) BREP(i,n,0)
#define pb push_back
#define inf 999999999
#define SIZE 10000000
#define mp make_pair
#define sz size()
#define NIL 0
#define DEBUG 0
#define all(vec) (vec).begin(),(vec).end()
#define NEG -1

bool isComposite(ll num) {
	for(ll i=2;i*i<=num;i++)
		if(num%i==0)
			return true;
	return false;
}

int main() {
	ll prime1=-1,prime2=-1,q;
	cin>>q;
	if(q==1 || !isComposite(q)) {
		cout<<"1\n0\n";
		return 0;
	}
	ll cnt=0;
	for(ll i=2;i*i<=q;i++) {
		while(q!=1 && q%i==0) {
			cnt++;
			q/=i;
			if(prime1==-1)
				prime1=i;
			else if(prime2==-1)
				prime2=i;
		}
	}

	if(q!=1) { //there is at least one more prime factor left eg 99=3x3x11
		cnt++;
		if(prime2==-1)
			prime2=q;
	}
	if(cnt>=3)
		cout<<"1\n"<<prime1*prime2<<"\n";
	else
		cout<<"2\n";
	return 0;
}


#include <cstdio>
#include <algorithm>
#include <iostream>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <vector>
#include <cstring>

using namespace std;

#define F first
#define S second
#define mp make_pair
#define pb push_back
typedef vector<int> VI;
typedef vector<VI> VII;
typedef pair<int,int> PII;
typedef long long LL;
bool isprime(long long N) {
    if(N == 1)
            return 1;
    for(long long i=2;i*i<=N;i++) {
        if(N%i == 0)
            return 0;
    }
    return 1;
}
int main() {
    long long N;
    cin>>N;
    if(isprime(N)) {
        printf("1\n0\n");
        return 0;
    }
    // if it has only two prime factors then 2 wins
    long long Nval = N;
    long long cnt = 0;
    long long myprime1 = -1;
    long long myprime2 = -1;
    for(long long i=2;i*i<=N;i++) {
        while(N!=1 && N%i == 0)
        {
            N = N/i;
            cnt++;
            if(myprime1 == -1)
            myprime1 = i;
            else
            myprime2 = i;
        }
    }
    if(N!=1) {
        cnt++;
        if(myprime2==-1)
            myprime2 = N;
    }
    //printf("cnt is %d\n",cnt);
    if(cnt >= 3)
    {
            cout<<1<<endl<<myprime1*myprime2<<endl;
            return 0;
    }
    else{
        cout<<2<<endl;
        //printf("1\n%I64d\n",Nval/myprime);
    }

    return 0;
}


#include<iostream>
#include<fstream>
#include<sstream>
#include<cstdio>
#include<stdlib.h>
#include<string>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<iomanip>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pa;
typedef vector<int> vi;
typedef vector<ll> vin;
typedef vector<string> vs;
typedef vector<vector<ll> > vvin;
typedef vector<bool> vb;

#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define BREP(i,a,b) for(ll i=a-1;i>=b;i--)
#define brep(i,n) BREP(i,n,0)
#define pb push_back
#define inf 999999999
#define SIZE 10000000
#define mp make_pair
#define sz size()
#define NIL 0
#define DEBUG 0
#define all(vec) (vec).begin(),(vec).end()
#define NEG -1

bool isComposite(ll num) {
	for(ll i=2;i*i<=num;i++)
		if(num%i==0)
			return true;
	return false;
}

int main() {
	ll q,i,fac1=-1,fac2=-1,fax=0;
	cin>>q;
	if(q==1 || q==2 || q==3 || q==5 || q==7) {
		cout<<"1\n0\n";
		return 0;
	}
	vin factors;
	//get all factors:
	for(i=2;i*i<=q;i++)
		if(!(q%i)) {
			factors.pb(i);
			factors.pb(q/i);
		}

	if(factors.sz==0) {
		cout<<"1\n0\n";
		return 0;
	}

	else if(factors.sz==2) {
		bool isPrime0=!isComposite(factors[0]);
		bool isPrime1=!isComposite(factors[1]);
		if(isPrime1 && isPrime0) {
			cout<<"2\n";
			return 0;
		}
		if(isPrime0==false) {
			cout<<"1\n"<<factors[0]<<"\n";
			return 0;
		}
		cout<<"1\n"<<factors[1]<<"\n";
		return 0;
	}
	ll ret;
	// >=3 factors: find any one composite factor
	rep(j,factors.sz)
		if(isComposite(factors[j])) {
			ret=factors[j];
			break;
		}
	cout<<"1\n"<<ret<<"\n";
	return 0;
}


#include<iostream>
#include<fstream>
#include<sstream>
#include<cstdio>
#include<stdlib.h>
#include<string>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<iomanip>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pa;
typedef vector<int> vi;
typedef vector<ll> vin;
typedef vector<string> vs;
typedef vector<vector<ll> > vvin;
typedef vector<bool> vb;

#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define BREP(i,a,b) for(ll i=a-1;i>=b;i--)
#define brep(i,n) BREP(i,n,0)
#define pb push_back
#define inf 999999999
#define SIZE 10000000
#define mp make_pair
#define sz size()
#define NIL 0
#define DEBUG 0
#define all(vec) (vec).begin(),(vec).end()
#define NEG -1

int main() {
	vin factors;
	ll q;
	int i;
	cin>>q;
	if(q==1 || q==2 || q==3 || q==5 || q==7) {
		cout<<"1\n0\n";
		return 0;
	}

	for(i=2;q!=1 && i<=(ll)sqrt(q);i++)
		while(!(q%i)) {
			factors.pb(i);
			q/=i;
		}

	if(factors.empty()) { //q is prime
		cout<<"1\n0\n";
		return 0;
	}
	if(factors.sz==2) { //q has to prime factors
		cout<<"2\n";
		return 0;
	}
	cout<<"1\n"<<factors[0]*factors[1]<<"\n";
	return 0;
}


#include<iostream>
#include<fstream>
#include<sstream>
#include<cstdio>
#include<stdlib.h>
#include<string>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<iomanip>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pa;
typedef vector<int> vi;
typedef vector<ll> vin;
typedef vector<string> vs;
typedef vector<vector<ll> > vvin;
typedef vector<bool> vb;

#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define BREP(i,a,b) for(ll i=a-1;i>=b;i--)
#define brep(i,n) BREP(i,n,0)
#define pb push_back
#define inf 999999999
#define SIZE 10000000
#define mp make_pair
#define sz size()
#define NIL 0
#define DEBUG 0
#define all(vec) (vec).begin(),(vec).end()
#define NEG -1

int main() {
	vin factors;
	ll q;
	int i;
	cin>>q;
	if(q==1 || q==2 || q==3 || q==5 || q==7) {
		cout<<"1\n0\n";
		return 0;
	}

	for(i=2;q!=1 && i<=(ll)sqrt(q);i++)
		while(!(q%i)) {
			factors.pb(i);
			q/=i;
		}

	if(factors.empty()) { //q is prime
		cout<<"1\n0\n";
		return 0;
	}
	if(factors.sz==2 || factors.sz==1) { //q has to prime factors
		cout<<"2\n";
		return 0;
	}
	cout<<"1\n"<<factors[0]*factors[1]<<"\n";
	return 0;
}


#include <cstdio>
#include <algorithm>
#include <iostream>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <vector>
#include <cstring>

using namespace std;

#define F first
#define S second
#define mp make_pair
#define pb push_back
typedef vector<int> VI;
typedef vector<VI> VII;
typedef pair<int,int> PII;
typedef long long LL;
bool isprime(long long N) {
    if(N == 1)
            return 1;
    for(long long i=2;i*i<=N;i++) {
        if(N%i == 0)
            return 0;
    }
    return 1;
}
int main() {
    long long N;
    cin>>N;
    if(isprime(N)) {
        printf("1\n0\n");
        return 0;
    }
    // if it has only two prime factors then 2 wins
    long long Nval = N;
    long long cnt = 0;
    long long myprime1 = -1;
    long long myprime2 = -1;
    for(long long i=2;i*i<=N;i++) {
        while(N!=1 && N%i == 0)
        {
            N = N/i;
            cnt++;
            if(myprime1 == -1)
            myprime1 = i;
            else
            myprime2 = i;
        }
    }
    if(N!=1) {
        cnt++;
        myprime2 = N;
    }
    //printf("cnt is %d\n",cnt);
    if(cnt >= 3)
    {
            cout<<1<<endl<<myprime1*myprime2<<endl;
            return 0;
    }
    else{
        cout<<2<<endl;
        //printf("1\n%I64d\n",Nval/myprime);
    }

    return 0;
}


#include<iostream>
#include<fstream>
#include<sstream>
#include<cstdio>
#include<stdlib.h>
#include<string>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<iomanip>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pa;
typedef vector<int> vi;
typedef vector<ll> vin;
typedef vector<string> vs;
typedef vector<vector<ll> > vvin;
typedef vector<bool> vb;

#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define BREP(i,a,b) for(ll i=a-1;i>=b;i--)
#define brep(i,n) BREP(i,n,0)
#define pb push_back
#define inf 999999999
#define SIZE 10000000
#define mp make_pair
#define sz size()
#define NIL 0
#define DEBUG 0
#define all(vec) (vec).begin(),(vec).end()
#define NEG -1

int main() {
	vin factors;
	ll q;
	cin>>q;
	if(q==1) {
		cout<<"1\n0\n";
		return 0;
	}
	REP(i,2,sqrt(q)+1)
		if(!(q%i))
			factors.pb(i);
	if(factors.empty()) {
		cout<<"1\n0\n";
		return 0;
	}
	if(factors.sz==1 || factors.sz==2) {
		cout<<"2\n";
		return 0;
	}
	cout<<"1\n"<<factors[0]*factors[1]<<"\n";
	return 0;
}


#include<iostream>
#include<fstream>
#include<sstream>
#include<cstdio>
#include<stdlib.h>
#include<string>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<iomanip>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pa;
typedef vector<int> vi;
typedef vector<ll> vin;
typedef vector<string> vs;
typedef vector<vector<ll> > vvin;
typedef vector<bool> vb;

#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define BREP(i,a,b) for(ll i=a-1;i>=b;i--)
#define brep(i,n) BREP(i,n,0)
#define pb push_back
#define inf 999999999
#define SIZE 10000000
#define mp make_pair
#define sz size()
#define NIL 0
#define DEBUG 0
#define all(vec) (vec).begin(),(vec).end()
#define NEG -1

int main() {
	vin factors;
	ll q;
	int i;
	cin>>q;
	if(q==1 || q==2 || q==3 || q==5 || q==7) {
		cout<<"1\n0\n";
		return 0;
	}
	double lim=sqrt(q);
	for(i=2;i<=(ll)(lim+0.5f);i++)
		if(!(q%i)) {
			factors.pb(i);
			factors.pb(q/i);
		}
	if(factors.empty()) { //q is prime
		cout<<"1\n0\n";
		return 0;
	}
	if(factors.sz==2) { //q has two prime factors
		cout<<"2\n";
		return 0;
	}
	cout<<"1\n"<<factors[1]<<"\n";
	return 0;
}


#include<iostream>
#include<fstream>
#include<sstream>
#include<cstdio>
#include<stdlib.h>
#include<string>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<iomanip>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pa;
typedef vector<int> vi;
typedef vector<ll> vin;
typedef vector<string> vs;
typedef vector<vector<ll> > vvin;
typedef vector<bool> vb;

#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define BREP(i,a,b) for(ll i=a-1;i>=b;i--)
#define brep(i,n) BREP(i,n,0)
#define pb push_back
#define inf 999999999
#define SIZE 10000000
#define mp make_pair
#define sz size()
#define NIL 0
#define DEBUG 0
#define all(vec) (vec).begin(),(vec).end()
#define NEG -1

bool isComposite(ll num) {
	for(ll i=2;i*i<=num;i++)
		if(num%i==0)
			return true;
	return false;
}

int main() {
	vin factors;
	ll q,i;
	cin>>q;
	if(q==1 || q==2 || q==3 || q==5 || q==7) {
		cout<<"1\n0\n";
		return 0;
	}
	ll Q=q;
	for(i=2;i*i<=Q;i++)
		while(!(q%i)) {
			factors.pb(i);
			q/=i;
		}
	if(factors.empty()) { //q is prime
		cout<<"1\n0\n";
		return 0;
	}
	if(factors.sz==2 || factors.sz==1) { //q has two prime factors
		cout<<"2\n";
		return 0;
	}
	cout<<"1\n"<<factors[0]*factors[1]<<"\n";
	return 0;
}


#include<iostream>
#include<fstream>
#include<sstream>
#include<cstdio>
#include<stdlib.h>
#include<string>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<iomanip>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pa;
typedef vector<int> vi;
typedef vector<ll> vin;
typedef vector<string> vs;
typedef vector<vector<ll> > vvin;
typedef vector<bool> vb;

#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define BREP(i,a,b) for(ll i=a-1;i>=b;i--)
#define brep(i,n) BREP(i,n,0)
#define pb push_back
#define inf 999999999
#define SIZE 10000000
#define mp make_pair
#define sz size()
#define NIL 0
#define DEBUG 0
#define all(vec) (vec).begin(),(vec).end()
#define NEG -1

int main() {
	vin factors;
	ll q;
	cin>>q;
	if(q==1 || q==2 || q==3 || q==5 || q==7) {
		cout<<"1\n0\n";
		return 0;
	}
	REP(i,2,(ll)sqrt(q)+1)
		if(!(q%i))
			factors.pb(i);

	if(factors.empty()) {
		cout<<"1\n0\n";
		return 0;
	}
	if(factors.sz==1 || factors.sz==2) {
		cout<<"2\n";
		return 0;
	}
	cout<<"1\n"<<factors[0]*factors[1]<<"\n";
	return 0;
}


#include<iostream>
#include<fstream>
#include<sstream>
#include<cstdio>
#include<stdlib.h>
#include<string>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<iomanip>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pa;
typedef vector<int> vi;
typedef vector<ll> vin;
typedef vector<string> vs;
typedef vector<vector<ll> > vvin;
typedef vector<bool> vb;

#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define BREP(i,a,b) for(ll i=a-1;i>=b;i--)
#define brep(i,n) BREP(i,n,0)
#define pb push_back
#define inf 999999999
#define SIZE 10000000
#define mp make_pair
#define sz size()
#define NIL 0
#define DEBUG 0
#define all(vec) (vec).begin(),(vec).end()
#define NEG -1

int main() {
	vin factors;
	ll q;
	int i;
	cin>>q;
	if(q==1 || q==2 || q==3 || q==5 || q==7) {
		cout<<"1\n0\n";
		return 0;
	}
	double lim=sqrt(q);
	for(i=2;q!=1 && i<=(ll)(lim+0.5f);i++)
		while(!(q%i)) {
			factors.pb(i);
			q/=i;
		}

	if(factors.empty()) { //q is prime
		cout<<"1\n0\n";
		return 0;
	}
	if(factors.sz==2 || factors.sz==1) { //q has to prime factors
		cout<<"2\n";
		return 0;
	}
	cout<<"1\n"<<factors[0]*factors[1]<<"\n";
	return 0;
}


#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

//#define NDEBUG
#if defined(NDEBUG)
#define DBG_CODE(cb...)
#else
#define DBG_CODE(cb...) cb
#endif
#define WRITE(x) DBG_CODE(cout << x << endl)
#define WATCH(x) DBG_CODE(cout << #x << "=" << x << endl)
#define FORN(i, a, b) for(typeof(b) i = (a); i < (b); i++)
#define ALL(x) x.begin(), x.end()
#define FOREACH(i, c) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)

typedef long long Int;
#define gcc 10007
#define MAX (( (Int) 1 << 63 ) - 1)
Int p[10] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29};

Int Gcd(Int x, Int y) { return y ? Gcd(y, x % y) : x; }
Int produc_mod(Int a, Int b, Int mod){
	Int sum = 0;
	while(b) { if (b & 1) sum  = (sum + a ) % mod; a = (a + a) % mod; b /= 2; }
	return sum;
}

Int power_mod(Int a, Int b, Int mod) {
	Int sum = 1;
	while(b){
		if (b & 1) sum = produc_mod(sum, a, mod);
		a = produc_mod(a, a, mod); b /= 2;
	}
	return sum;
}

bool rabin_miller(Int n){
	int i, j, k = 0; Int u, m, buf;
	if (n == 2) return true;
	if (n < 2 or !(n & 1)) return false;
	m = n - 1;
	while (!(m & 1)) { k++; m /= 2; }
	for(i = 0; i < 9; i++){
		if (p[i] >= n) return true;
		u = power_mod(p[i], m, n);
		if (u == 1) continue;
		for ( j = 0; j < k; j++) {
			buf = produc_mod(u, u, n);
			if (buf == 1 and u != 1 and u != n-1 ) return false;
			u = buf;
		}
		if (u-1) return false;
	}
	return true;
}

Int pollard_rho(Int n){
	while(true){
		int i = 1;
		Int x = rand() % (n-1) + 1, y = x, k = 2, d;
		do {
			i++; d = Gcd(n + y - x, n);
			if (d > 1 and d < n) return d;
			if (i == k) y = x, k *= 2;
			x = (produc_mod(x, x, n) + n - gcc ) % n;
		} while (y != x);
	}
}

Int prime[1000000];
int top;
void prime_divisor(Int key){
	if ( rabin_miller(key) ) prime[top++] = key;
	else {
		Int buf = pollard_rho(key);
 		if (rabin_miller(key) ) prime[top++] = buf;
 		else prime_divisor(buf);
 		if (rabin_miller(key / buf ) ) prime[top++] = key / buf;
 		else prime_divisor(key / buf);
	}
}

int main(){
	Int n;
	cin >> n;
	if(n == 1){
		cout << "1\n0\n";
		return 0;
	}
	top = 0;
	memset(prime, 0, sizeof(prime));
	prime_divisor(n);
	Int counter = 0;
	Int cn = n;
	Int move = 1;
	FORN(i, 0, top){
		while(cn % prime[i] == 0){
			cn /= prime[i];
			counter++;
			if(counter > 2)
				goto out;
			move *= prime[i];
		}
	}
	out:
	move = (counter <= 1) ? 0 : n / move;

	if(counter == 2)
		cout << "2\n";
	else
		cout << "1\n" << move << "\n";
}


#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

//#define NDEBUG
#if defined(NDEBUG)
#define DBG_CODE(cb...)
#else
#define DBG_CODE(cb...) cb
#endif
#define WRITE(x) DBG_CODE(cout << x << endl)
#define WATCH(x) DBG_CODE(cout << #x << "=" << x << endl)
#define FORN(i, a, b) for(typeof(b) i = (a); i < (b); i++)
#define ALL(x) x.begin(), x.end()
#define FOREACH(i, c) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)

typedef long long Int;
#define gcc 10007
#define MAX (( (Int) 1 << 63 ) - 1)
Int p[10] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29};

Int Gcd(Int x, Int y) { return y ? Gcd(y, x % y) : x; }
Int produc_mod(Int a, Int b, Int mod){
	Int sum = 0;
	while(b) { if (b & 1) sum  = (sum + a ) % mod; a = (a + a) % mod; b /= 2; }
	return sum;
}

Int power_mod(Int a, Int b, Int mod) {
	Int sum = 1;
	while(b){
		if (b & 1) sum = produc_mod(sum, a, mod);
		a = produc_mod(a, a, mod); b /= 2;
	}
	return sum;
}

bool rabin_miller(Int n){
	int i, j, k = 0; Int u, m, buf;
	if (n == 2) return true;
	if (n < 2 or !(n & 1)) return false;
	m = n - 1;
	while (!(m & 1)) { k++; m /= 2; }
	for(i = 0; i < 9; i++){
		if (p[i] >= n) return true;
		u = power_mod(p[i], m, n);
		if (u == 1) continue;
		for ( j = 0; j < k; j++) {
			buf = produc_mod(u, u, n);
			if (buf == 1 and u != 1 and u != n-1 ) return false;
			u = buf;
		}
		if (u-1) return false;
	}
	return true;
}

Int pollard_rho(Int n){
	while(true){
		int i = 1;
		Int x = rand() % (n-1) + 1, y = x, k = 2, d;
		do {
			i++; d = Gcd(n + y - x, n);
			if (d > 1 and d < n) return d;
			if (i == k) y = x, k *= 2;
			x = (produc_mod(x, x, n) + n - gcc ) % n;
		} while (y != x);
	}
}

Int prime[1000000];
int top;
void prime_divisor(Int key){
	if ( rabin_miller(key) ) prime[top++] = key;
	else {
		Int buf = pollard_rho(key);
 		if (rabin_miller(key) ) prime[top++] = buf;
 		else prime_divisor(buf);
 		if (rabin_miller(key / buf ) ) prime[top++] = key / buf;
 		else prime_divisor(key / buf);
	}
}

int main(){
	Int n;
	cin >> n;
	if(n == 1){
		cout << "1\n0\n";
		return 0;
	}
	top = 0;
	memset(prime, 0, sizeof(prime));
	prime_divisor(n);
	Int counter = 0;
	Int cn = n;
	Int move = 1;
	FORN(i, 0, top){
		while(cn % prime[i] == 0){
			cn /= prime[i];
			counter++;
			if(counter > 2)
				goto out;
			move *= prime[i];
		}
	}
	out:
	move = (counter <= 1) ? 0 :  move;

	if(counter == 2)
		cout << "2\n";
	else
		cout << "1\n" << move << "\n";
}


#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

//#define NDEBUG
#if defined(NDEBUG)
#define DBG_CODE(cb...)
#else
#define DBG_CODE(cb...) cb
#endif
#define WRITE(x) DBG_CODE(cout << x << endl)
#define WATCH(x) DBG_CODE(cout << #x << "=" << x << endl)
#define FORN(i, a, b) for(typeof(b) i = (a); i < (b); i++)
#define ALL(x) x.begin(), x.end()
#define FOREACH(i, c) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)

#define SIEVE_N 5000000

bool composite[SIEVE_N + 1];
vector<int> primes;

void sieve()
{
	int sqrt_n = 2;
	while(sqrt_n * sqrt_n < SIEVE_N) sqrt_n++;

	memset(composite, 0, sizeof(composite));
	composite[0] = true;
	composite[1] = true;

	for(int m = 4; m <= SIEVE_N; m += 2) composite[m] = true;

	for(int p = 3; p <= sqrt_n; p += 2){
		if(composite[p]) continue;
		for(int m = p * p; m <= SIEVE_N; m += p + p) composite[m] = true;
	}

	primes.push_back(2);
	for(int i = 3; i < SIEVE_N; i += 2)
		if(not composite[i])
			primes.push_back(i);
}

typedef long long ll;

int main(){
	//Descomente para acelerar cin
	//ios::sync_with_stdio(false);
	sieve();
	ll n;
	scanf("%lld", &n);
	int k = 0;
	ll move = 1;
	ll cn = n;
	FOREACH(p, primes){
		while(cn % *p == 0){
			k++;
			cn /= *p;
			if(k > 2)
				goto out;
			move *= *p;
		}
	}
	out:

	if(k <= 1)
		printf("1\n0\n");
	else if(k == 2)
		printf("2\n");
	else
		printf("1\n%lld\n", move);

}


#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

//#define NDEBUG
#if defined(NDEBUG)
#define DBG_CODE(cb...)
#else
#define DBG_CODE(cb...) cb
#endif
#define WRITE(x) DBG_CODE(cout << x << endl)
#define WATCH(x) DBG_CODE(cout << #x << "=" << x << endl)
#define FORN(i, a, b) for(typeof(b) i = (a); i < (b); i++)
#define ALL(x) x.begin(), x.end()
#define FOREACH(i, c) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)

#define SIEVE_N 5000000

bool composite[SIEVE_N + 1];
vector<int> primes;

void sieve()
{
	int sqrt_n = 2;
	while(sqrt_n * sqrt_n < SIEVE_N) sqrt_n++;

	memset(composite, 0, sizeof(composite));
	composite[0] = true;
	composite[1] = true;

	for(int m = 4; m <= SIEVE_N; m += 2) composite[m] = true;

	for(int p = 3; p <= sqrt_n; p += 2){
		if(composite[p]) continue;
		for(int m = p * p; m <= SIEVE_N; m += p + p) composite[m] = true;
	}

	primes.push_back(2);
	for(int i = 3; i < SIEVE_N; i += 2)
		if(not composite[i])
			primes.push_back(i);
}

typedef long long ll;

int main(){
	//Descomente para acelerar cin
	//ios::sync_with_stdio(false);
	sieve();
	ll n;
	cin >> n;
	int k = 0;
	ll move = 1;
	ll cn = n;
	FOREACH(p, primes){
		while(cn % *p == 0){
			k++;
			cn /= *p;
			if(k > 2)
				goto out;
			move *= *p;
		}
	}
	if(cn > 1)
		k++;
	out:

	if(k <= 1)
		cout << "1\n0\n";
	else if(k == 2)
		cout << "2\n";
	else
		cout << "1\n" << move << "\n";

}


#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

//#define NDEBUG
#if defined(NDEBUG)
#define DBG_CODE(cb...)
#else
#define DBG_CODE(cb...) cb
#endif
#define WRITE(x) DBG_CODE(cout << x << endl)
#define WATCH(x) DBG_CODE(cout << #x << "=" << x << endl)
#define FORN(i, a, b) for(typeof(b) i = (a); i < (b); i++)
#define ALL(x) x.begin(), x.end()
#define FOREACH(i, c) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)

#define SIEVE_N 4000000

bool composite[SIEVE_N + 1];
vector<int> primes;

void sieve()
{
	int sqrt_n = 2;
	while(sqrt_n * sqrt_n < SIEVE_N) sqrt_n++;

	memset(composite, 0, sizeof(composite));
	composite[0] = true;
	composite[1] = true;

	for(int m = 4; m <= SIEVE_N; m += 2) composite[m] = true;

	for(int p = 3; p <= sqrt_n; p += 2){
		if(composite[p]) continue;
		for(int m = p * p; m <= SIEVE_N; m += p + p) composite[m] = true;
	}

	primes.push_back(2);
	for(int i = 3; i < SIEVE_N; i += 2)
		if(not composite[i])
			primes.push_back(i);
}

typedef long long ll;

int main(){
	//Descomente para acelerar cin
	//ios::sync_with_stdio(false);
	sieve();
	ll n;
	scanf("%lld", &n);
	int k = 0;
	ll move = 1;
	ll cn = n;
	FOREACH(p, primes){
		while(cn % *p == 0){
			k++;
			cn /= *p;
			if(k > 2)
				goto out;
			move *= *p;
		}
	}
	out:

	if(k <= 1)
		printf("1\n0\n");
	else if(k == 2)
		printf("2\n");
	else
		printf("1\n%lld\n", move);

}


#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

//#define NDEBUG
#if defined(NDEBUG)
#define DBG_CODE(cb...)
#else
#define DBG_CODE(cb...) cb
#endif
#define WRITE(x) DBG_CODE(cout << x << endl)
#define WATCH(x) DBG_CODE(cout << #x << "=" << x << endl)
#define FORN(i, a, b) for(typeof(b) i = (a); i < (b); i++)
#define ALL(x) x.begin(), x.end()
#define FOREACH(i, c) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)

typedef long long Int;
#define gcc 10007
#define MAX (( (Int) 1 << 63 ) - 1)
Int p[10] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29};

Int Gcd(Int x, Int y) { return y ? Gcd(y, x % y) : x; }
Int produc_mod(Int a, Int b, Int mod){
	Int sum = 0;
	while(b) { if (b & 1) sum  = (sum + a ) % mod; a = (a + a) % mod; b /= 2; }
	return sum;
}

Int power_mod(Int a, Int b, Int mod) {
	Int sum = 1;
	while(b){
		if (b & 1) sum = produc_mod(sum, a, mod);
		a = produc_mod(a, a, mod); b /= 2;
	}
	return sum;
}

bool rabin_miller(Int n){
	int i, j, k = 0; Int u, m, buf;
	if (n == 2) return true;
	if (n < 2 or !(n & 1)) return false;
	m = n - 1;
	while (!(m & 1)) { k++; m /= 2; }
	for(i = 0; i < 9; i++){
		if (p[i] >= n) return true;
		u = power_mod(p[i], m, n);
		if (u == 1) continue;
		for ( j = 0; j < k; j++) {
			buf = produc_mod(u, u, n);
			if (buf == 1 and u != 1 and u != n-1 ) return false;
			u = buf;
		}
		if (u-1) return false;
	}
	return true;
}

Int pollard_rho(Int n){
	while(true){
		int i = 1;
		Int x = rand() % (n-1) + 1, y = x, k = 2, d;
		do {
			i++; d = Gcd(n + y - x, n);
			if (d > 1 and d < n) return d;
			if (i == k) y = x, k *= 2;
			x = (produc_mod(x, x, n) + n - gcc ) % n;
		} while (y != x);
	}
}

Int prime[1000000];
int top;
void prime_divisor(Int key){
	if ( rabin_miller(key) ) prime[top++] = key;
	else {
		Int buf = pollard_rho(key);
 		if (rabin_miller(key) ) prime[top++] = buf;
 		else prime_divisor(buf);
 		if (rabin_miller(key / buf ) ) prime[top++] = key / buf;
 		else prime_divisor(key / buf);
	}
}

int main(){
	ios::sync_with_stdio(false);
	Int n;
	cin >> n;
	if(n == 1){
		printf("1\n0\n");
		return 0;
	}
	top = 0;
	memset(prime, 0, sizeof(prime));
	prime_divisor(n);
	Int counter = 0;
	Int cn = n;
	Int move = 1;
	FORN(i, 0, top){
		while(cn % prime[i] == 0){
			cn /= prime[i];
			counter++;
			if(counter > 2)
				goto out;
			move *= prime[i];
		}
	}
	out:
	move = (counter <= 1) ? 0 : n / move;

	if(counter == 2)
		printf("2\n");
	else
		printf("1\n%lld\n", move);
}


#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

//#define NDEBUG
#if defined(NDEBUG)
#define DBG_CODE(cb...)
#else
#define DBG_CODE(cb...) cb
#endif
#define WRITE(x) DBG_CODE(cout << x << endl)
#define WATCH(x) DBG_CODE(cout << #x << "=" << x << endl)
#define FORN(i, a, b) for(typeof(b) i = (a); i < (b); i++)
#define ALL(x) x.begin(), x.end()
#define FOREACH(i, c) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)

typedef long long Int;
#define gcc 10007
#define MAX (( (Int) 1 << 63 ) - 1)
Int p[10] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29};

Int Gcd(Int x, Int y) { return y ? Gcd(y, x % y) : x; }
Int produc_mod(Int a, Int b, Int mod){
	Int sum = 0;
	while(b) { if (b & 1) sum  = (sum + a ) % mod; a = (a + a) % mod; b /= 2; }
	return sum;
}

Int power_mod(Int a, Int b, Int mod) {
	Int sum = 1;
	while(b){
		if (b & 1) sum = produc_mod(sum, a, mod);
		a = produc_mod(a, a, mod); b /= 2;
	}
	return sum;
}

bool rabin_miller(Int n){
	int i, j, k = 0; Int u, m, buf;
	if (n == 2) return true;
	if (n < 2 or !(n & 1)) return false;
	m = n - 1;
	while (!(m & 1)) { k++; m /= 2; }
	for(i = 0; i < 9; i++){
		if (p[i] >= n) return true;
		u = power_mod(p[i], m, n);
		if (u == 1) continue;
		for ( j = 0; j < k; j++) {
			buf = produc_mod(u, u, n);
			if (buf == 1 and u != 1 and u != n-1 ) return false;
			u = buf;
		}
		if (u-1) return false;
	}
	return true;
}

Int pollard_rho(Int n){
	while(true){
		int i = 1;
		Int x = rand() % (n-1) + 1, y = x, k = 2, d;
		do {
			i++; d = Gcd(n + y - x, n);
			if (d > 1 and d < n) return d;
			if (i == k) y = x, k *= 2;
			x = (produc_mod(x, x, n) + n - gcc ) % n;
		} while (y != x);
	}
}

Int prime[1000000];
int top;
void prime_divisor(Int key){
	if ( rabin_miller(key) ) prime[top++] = key;
	else {
		Int buf = pollard_rho(key);
 		if (rabin_miller(key) ) prime[top++] = buf;
 		else prime_divisor(buf);
 		if (rabin_miller(key / buf ) ) prime[top++] = key / buf;
 		else prime_divisor(key / buf);
	}
}

int main(){
	ios::sync_with_stdio(false);
	Int n;
	cin >> n;
	if(n == 1){
		printf("1\n0\n");
		return 0;
	}
	top = 0;
	memset(prime, 0, sizeof(prime));
	prime_divisor(n);
	Int counter = 0;
	Int cn = n;
	Int move = 1;
	FORN(i, 0, top){
		while(cn % prime[i] == 0){
			cn /= prime[i];
			counter++;
			if(counter > 2)
				goto out;
			move *= prime[i];
		}
	}
	out:
	move = n / move;

	if(counter == 2)
		printf("2\n");
	else
		printf("1\n%lld\n", move);
}


#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

//#define NDEBUG
#if defined(NDEBUG)
#define DBG_CODE(cb...)
#else
#define DBG_CODE(cb...) cb
#endif
#define WRITE(x) DBG_CODE(cout << x << endl)
#define WATCH(x) DBG_CODE(cout << #x << "=" << x << endl)
#define FORN(i, a, b) for(typeof(b) i = (a); i < (b); i++)
#define ALL(x) x.begin(), x.end()
#define FOREACH(i, c) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)

#define SIEVE_N 5000000

bool composite[SIEVE_N + 1];
vector<int> primes;

void sieve()
{
	int sqrt_n = 2;
	while(sqrt_n * sqrt_n < SIEVE_N) sqrt_n++;

	memset(composite, 0, sizeof(composite));
	composite[0] = true;
	composite[1] = true;

	for(int m = 4; m <= SIEVE_N; m += 2) composite[m] = true;

	for(int p = 3; p <= sqrt_n; p += 2){
		if(composite[p]) continue;
		for(int m = p * p; m <= SIEVE_N; m += p + p) composite[m] = true;
	}

	primes.push_back(2);
	for(int i = 3; i < SIEVE_N; i += 2)
		if(not composite[i])
			primes.push_back(i);
}

typedef long long ll;

int main(){
	//Descomente para acelerar cin
	//ios::sync_with_stdio(false);
	sieve();
	ll n;
	scanf("%lld", &n);
	int k = 0;
	ll move = 1;
	ll cn = n;
	FOREACH(p, primes){
		while(cn % *p == 0){
			k++;
			cn /= *p;
			if(k > 2)
				goto out;
			move *= *p;
		}
	}
	out:

	if(k <= 1)
		printf("1\n0\n");
	else if(k == 2)
		printf("2\n");
	else
		printf("1\n%lld\n", move);

	printf("n = %lld\n", n);

}


#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

//#define NDEBUG
#if defined(NDEBUG)
#define DBG_CODE(cb...)
#else
#define DBG_CODE(cb...) cb
#endif
#define WRITE(x) DBG_CODE(cout << x << endl)
#define WATCH(x) DBG_CODE(cout << #x << "=" << x << endl)
#define FORN(i, a, b) for(typeof(b) i = (a); i < (b); i++)
#define ALL(x) x.begin(), x.end()
#define FOREACH(i, c) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)

#define SIEVE_N 5000000

bool composite[SIEVE_N + 1];
vector<int> primes;

void sieve()
{
	int sqrt_n = 2;
	while(sqrt_n * sqrt_n < SIEVE_N) sqrt_n++;

	memset(composite, 0, sizeof(composite));
	composite[0] = true;
	composite[1] = true;

	for(int m = 4; m <= SIEVE_N; m += 2) composite[m] = true;

	for(int p = 3; p <= sqrt_n; p += 2){
		if(composite[p]) continue;
		for(int m = p * p; m <= SIEVE_N; m += p + p) composite[m] = true;
	}

	primes.push_back(2);
	for(int i = 3; i < SIEVE_N; i += 2)
		if(not composite[i])
			primes.push_back(i);
}

typedef long long ll;

int main(){
	//Descomente para acelerar cin
	//ios::sync_with_stdio(false);
	sieve();
	ll n;
	cin >> n;
	int k = 0;
	ll move = 1;
	ll cn = n;
	FOREACH(p, primes){
		while(cn % *p == 0){
			k++;
			cn /= *p;
			if(k > 2)
				goto out;
			move *= *p;
		}
	}
	out:

	if(k <= 1)
		cout << "1\n0\n";
	else if(k == 2)
		cout << "2\n";
	else
		cout << "1\n" << move << "\n";

}


#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

//#define NDEBUG
#if defined(NDEBUG)
#define DBG_CODE(cb...)
#else
#define DBG_CODE(cb...) cb
#endif
#define WRITE(x) DBG_CODE(cout << x << endl)
#define WATCH(x) DBG_CODE(cout << #x << "=" << x << endl)
#define FORN(i, a, b) for(typeof(b) i = (a); i < (b); i++)
#define ALL(x) x.begin(), x.end()
#define FOREACH(i, c) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)

typedef long long Int;
#define gcc 10007
#define MAX (( (Int) 1 << 63 ) - 1)
Int p[10] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29};

Int Gcd(Int x, Int y) { return y ? Gcd(y, x % y) : x; }
Int produc_mod(Int a, Int b, Int mod){
	Int sum = 0;
	while(b) { if (b & 1) sum  = (sum + a ) % mod; a = (a + a) % mod; b /= 2; }
	return sum;
}

Int power_mod(Int a, Int b, Int mod) {
	Int sum = 1;
	while(b){
		if (b & 1) sum = produc_mod(sum, a, mod);
		a = produc_mod(a, a, mod); b /= 2;
	}
	return sum;
}

bool rabin_miller(Int n){
	int i, j, k = 0; Int u, m, buf;
	if (n == 2) return true;
	if (n < 2 or !(n & 1)) return false;
	m = n - 1;
	while (!(m & 1)) { k++; m /= 2; }
	for(i = 0; i < 9; i++){
		if (p[i] >= n) return true;
		u = power_mod(p[i], m, n);
		if (u == 1) continue;
		for ( j = 0; j < k; j++) {
			buf = produc_mod(u, u, n);
			if (buf == 1 and u != 1 and u != n-1 ) return false;
			u = buf;
		}
		if (u-1) return false;
	}
	return true;
}

Int pollard_rho(Int n){
	while(true){
		int i = 1;
		Int x = rand() % (n-1) + 1, y = x, k = 2, d;
		do {
			i++; d = Gcd(n + y - x, n);
			if (d > 1 and d < n) return d;
			if (i == k) y = x, k *= 2;
			x = (produc_mod(x, x, n) + n - gcc ) % n;
		} while (y != x);
	}
}

Int prime[1000000];
int top;
void prime_divisor(Int key){
	if ( rabin_miller(key) ) prime[top++] = key;
	else {
		Int buf = pollard_rho(key);
 		if (rabin_miller(key) ) prime[top++] = buf;
 		else prime_divisor(buf);
 		if (rabin_miller(key / buf ) ) prime[top++] = key / buf;
 		else prime_divisor(key / buf);
	}
}

int main(){
	Int n;
	scanf("%lld", &n);
	if(n == 1){
		printf("1\n0\n");
		return 0;
	}
	top = 0;
	memset(prime, 0, sizeof(prime));
	prime_divisor(n);
	Int counter = 0;
	Int cn = n;
	Int move = 1;
	FORN(i, 0, top){
		while(cn % prime[i] == 0){
			cn /= prime[i];
			counter++;
			if(counter > 2)
				goto out;
			move *= prime[i];
		}
	}
	out:
	move = (counter <= 1) ? 0 : n / move;

	if(counter == 2)
		printf("2\n");
	else
		printf("1\n%lld\n", move);
}


#include <iostream>
using namespace std;

//bool vis[1000000]={false};
//bool isp[1000000]={false};

bool isPrime(int x)
{
	/*
	if(x<1000000&&vis[x])
		return isp[x];
	if(x<1000000)
		vis[x]=true;
	*/
	for(int i=2;i*i<=x;i++)
		if(x%i==0)
		{
			//if(x<1000000)isp[x]=false;
			return false;
		}
	//if(x<1000000)
	//	isp[x]=true;
	return true;
}

bool check(long long x)
{
	int i,cnt=0;
	for(i=2;i*i<x;i++)
		if(x%i==0&&isPrime(i)&&isPrime(x/i))
		{
			cnt+=2;
			if(cnt>2)return false;
		}
	if(i*i==x&&isPrime(i))
		cnt++;
	return cnt==2||cnt==1;
}

int find(long long x)
{
	for(long long i=4;i*i<=x;i++)
		if(x%i==0)
		{
			if(check(i))
				return i;
			if(check(x/i))
				return x/i;
		}
	return -1;
}

int getDiv(long long x)
{
	for(long long i=2;i*i<=x;i++)
		if(x%i==0)return i;
	return x;
}

int main()
{
	long long n;
	//vis[2]=true;isp[2]=true;
	while(cin>>n)
	{
		if(n==1||isPrime(n))
		{
			cout<<1<<endl<<0<<endl;
			continue;
		}
		int res=find(n);
		if(check(n))
			cout<<2<<endl;
		else if(res>0)
			cout<<1<<endl<<res<<endl;
		else
			cout<<1<<endl<<getDiv(n)<<endl;
	}
	return 0;
}


#include <iostream>
using namespace std;

bool isPrime(long long x)
{
	if(x==2)return true;
	for(long long i=2;i*i<=x;i++)
		if(x%i==0)
			return false;
	return true;
}

int main()
{
	int q;
	cin>>q;
	int que[2];
	if(isPrime(q))
	{
		cout<<1<<endl<<0<<endl;
		return 0;
	}
	for(int t=0;t<2;t++)
	{
		for(int i=2;i<=q;i++)
			if(q%i==0&&isPrime(i))
			{
				que[t]=i;
				q/=i;
				break;
			}
	}
	if(q==1)
	{
		cout<<2<<endl;
		return 0;
	}
	cout<<1<<endl<<que[0]*que[1]<<endl;
	return 0;
}


#include <iostream>
using namespace std;

bool isPrime(long long x)
{
	if(x==2)return true;
	for(long long i=2;i*i<=x;i++)
		if(x%i==0)
			return false;
	return true;
}

int main()
{
	long long q;
	cin>>q;
	int idx=0;
	long long que[2];
	if(isPrime(q))
	{
		cout<<1<<endl<<0<<endl;
		return 0;
	}
	while(idx<2)
	{
		for(long long i=2;i<=q;i++)
			if(q%i==0&&isPrime(i))
			{
				que[idx++]=i;
				q/=i;
				if(isPrime(q))
				{
					que[idx++]=i;
					q=1;
				}
				break;
			}
	}
	if(q==1)
	{
		cout<<2<<endl;
		return 0;
	}
	cout<<1<<endl<<que[0]*que[1]<<endl;
	return 0;
}


#include <iostream>
using namespace std;

//bool vis[1000000]={false};
//bool isp[1000000]={false};

bool isPrime(long long x)
{
	/*
	if(x<1000000&&vis[x])
		return isp[x];
	if(x<1000000)
		vis[x]=true;
	*/
	for(long long i=2;i*i<=x;i++)
		if(x%i==0)
		{
			//if(x<1000000)isp[x]=false;
			return false;
		}
	//if(x<1000000)
	//	isp[x]=true;
	return true;
}

bool check(long long x)
{
	long long i,cnt=0;
	for(i=2;i*i<x;i++)
		if(x%i==0&&isPrime(i)&&isPrime(x/i))
		{
			cnt+=2;
			if(cnt>2)return false;
		}
	if(i*i==x&&isPrime(i))
		cnt++;
	return cnt==2||cnt==1;
}

int find(long long x)
{
	for(long long i=4;i*i<=x;i++)
		if(x%i==0)
		{
			if(check(i))
				return i;
			if(check(x/i))
				return x/i;
		}
	return -1;
}

int getDiv(long long x)
{
	for(long long i=2;i*i<=x;i++)
		if(x%i==0)return i;
	return x;
}

int main()
{
	long long n;
	//vis[2]=true;isp[2]=true;
	while(cin>>n)
	{
		if(n==1||isPrime(n))
		{
			cout<<1<<endl<<0<<endl;
			continue;
		}
		long long res=find(n);
		if(check(n))
			cout<<2<<endl;
		else if(res>0)
			cout<<1<<endl<<res<<endl;
		else
			cout<<1<<endl<<getDiv(n)<<endl;
	}
	return 0;
}


#include <iostream>
using namespace std;

bool isPrime(long long x)
{
	if(x==1)return false;
	if(x==2)return true;
	for(long long i=2;i*i<=x;i++)
		if(x%i==0)
			return false;
	return true;
}

int main()
{
	long long q;
	cin>>q;
	int idx=0;
	long long que[2];
	if(q==1||isPrime(q))
	{
		cout<<1<<endl<<0<<endl;
		return 0;
	}
	while(idx<2)
	{
		for(long long i=2;i<=q;i++)
			if(q%i==0&&isPrime(i))
			{
				que[idx++]=i;
				q/=i;
				if(idx<2&&isPrime(q))
				{
					que[idx++]=i;
					q=1;
				}
				break;
			}
	}
	if(q==1)
	{
		cout<<2<<endl;
		return 0;
	}
	cout<<1<<endl<<que[0]*que[1]<<endl;
	return 0;
}


#include <iostream>
using namespace std;

bool isPrime(long long x)
{
	if(x==2)return true;
	for(long long i=2;i*i<=x;i++)
		if(x%i==0)
			return false;
	return true;
}

int main()
{
	long long q;
	cin>>q;
	int idx=0;
	long long que[2];
	if(isPrime(q))
	{
		cout<<1<<endl<<0<<endl;
		return 0;
	}
	while(idx<2)
	{
		for(long long i=2;i<=q;i++)
			if(q%i==0&&isPrime(i))
			{
				que[idx++]=i;
				q/=i;
				if(q!=1&&isPrime(q))
				{
					que[idx++]=i;
					q=1;
				}
				break;
			}
	}
	if(q==1)
	{
		cout<<2<<endl;
		return 0;
	}
	cout<<1<<endl<<que[0]*que[1]<<endl;
	return 0;
}


#include <iostream>
using namespace std;

bool isPrime(long long x)
{
	if(x==1)return false;
	if(x==2)return true;
	for(long long i=2;i*i<=x;i++)
		if(x%i==0)
			return false;
	return true;
}

int main()
{
	long long q;
	cin>>q;
	int idx=0;
	long long que[2];
	if(isPrime(q))
	{
		cout<<1<<endl<<0<<endl;
		return 0;
	}
	while(idx<2)
	{
		for(long long i=2;i<=q;i++)
			if(q%i==0&&isPrime(i))
			{
				que[idx++]=i;
				q/=i;
				if(idx<2&&isPrime(q))
				{
					que[idx++]=i;
					q=1;
				}
				break;
			}
	}
	if(q==1)
	{
		cout<<2<<endl;
		return 0;
	}
	cout<<1<<endl<<que[0]*que[1]<<endl;
	return 0;
}


#include <iostream>
using namespace std;

bool isPrime(long long x)
{
	if(x==2)return true;
	for(long long i=2;i*i<=x;i++)
		if(x%i==0)
			return false;
	return true;
}

int main()
{
	long long q;
	cin>>q;
	int que[2];
	if(isPrime(q))
	{
		cout<<1<<endl<<0<<endl;
		return 0;
	}
	for(int t=0;t<2;t++)
	{
		for(int i=2;i<=q;i++)
			if(q%i==0&&isPrime(i))
			{
				que[t]=i;
				q/=i;
				break;
			}
	}
	if(q==1)
	{
		cout<<2<<endl;
		return 0;
	}
	cout<<1<<endl<<que[0]*que[1]<<endl;
	return 0;
}


#include <iostream>
using namespace std;

//bool vis[1000000]={false};
//bool isp[1000000]={false};

bool isPrime(long long x)
{
	/*
	if(x<1000000&&vis[x])
		return isp[x];
	if(x<1000000)
		vis[x]=true;
	*/
	for(long long i=2;i*i<=x;i++)
		if(x%i==0)
		{
			//if(x<1000000)isp[x]=false;
			return false;
		}
	//if(x<1000000)
	//	isp[x]=true;
	return true;
}

bool check(long long x)
{
	long long i,cnt=0;
	for(i=2;i*i<x;i++)
		if(x%i==0&&isPrime(i)&&isPrime(x/i))
		{
			cnt+=2;
			if(cnt>2)return false;
		}
	if(i*i==x&&isPrime(i))
		cnt++;
	return cnt==2||cnt==1;
}

int find(long long x)
{
	for(long long i=2;i*i<=x;i++)
		if(x%i==0)
		{
			if(check(i)&&!isPrime(i))
				return i;
			if(check(x/i))
				return x/i;
		}
	return -1;
}

int getDiv(long long x)
{
	for(long long i=2;i*i<=x;i++)
		if(x%i==0)return i;
	return x;
}

int main()
{
	long long n;
	//vis[2]=true;isp[2]=true;
	while(cin>>n)
	{
		if(n==1||isPrime(n))
		{
			cout<<1<<endl<<0<<endl;
			continue;
		}
		long long res=find(n);
		if(check(n))
			cout<<2<<endl;
		else if(res>0)
			cout<<1<<endl<<res<<endl;
		else
			cout<<1<<endl<<getDiv(n)<<endl;
	}
	return 0;
}


#include <iostream>
using namespace std;

bool vis[1000000]={false};
bool isp[1000000]={false};

bool isPrime(int x)
{
	if(x<1000000&&vis[x])
		return isp[x];
	if(x<1000000)
		vis[x]=true;
	for(int i=2;i*i<=x;i++)
		if(x%i==0)
		{
			if(x<1000000)isp[x]=false;
			return false;
		}
	if(x<1000000)
		isp[x]=true;
	return true;
}

bool check(long long x)
{
	int i,cnt=0;
	for(i=2;i*i<x;i++)
		if(x%i==0&&isPrime(i)&&isPrime(x/i))
		{
			cnt+=2;
			if(cnt>2)return false;
		}
	if(i*i==x&&isPrime(i))
		cnt++;
	return cnt==2||cnt==1;
}

int find(long long x)
{
	for(long long i=4;i*i<=x;i++)
		if(x%i==0)
		{
			if(check(i))
				return i;
			if(check(x/i))
				return x/i;
		}
	return -1;
}

int main()
{
	int n;
	vis[2]=true;isp[2]=true;
	while(cin>>n)
	{
		if(n==1||isPrime(n))
		{
			cout<<1<<endl<<0<<endl;
			continue;
		}
		int res=find(n);
		if(res>0)
			cout<<1<<endl<<res<<endl;
		else
			cout<<2<<endl;
	}
	return 0;
}


#include <iostream>
using namespace std;

bool vis[1000000]={false};
bool isp[1000000]={false};

bool isPrime(int x)
{
	if(x<1000000&&vis[x])
		return isp[x];
	if(x<1000000)
		vis[x]=true;
	for(int i=2;i*i<=x;i++)
		if(x%i==0)
		{
			if(x<1000000)isp[x]=false;
			return false;
		}
	if(x<1000000)
		isp[x]=true;
	return true;
}

bool check(long long x)
{
	int i,cnt=0;
	for(i=2;i*i<x;i++)
		if(x%i==0&&isPrime(i)&&isPrime(x/i))
		{
			cnt+=2;
			if(cnt>2)return false;
		}
	if(i*i==x&&isPrime(i))
		cnt++;
	return cnt==2||cnt==1;
}

int find(long long x)
{
	for(long long i=4;i*i<=x;i++)
		if(x%i==0)
		{
			if(check(i))
				return i;
			if(check(x/i))
				return x/i;
		}
	return -1;
}

int getDiv(long long x)
{
	for(long long i=2;i*i<=x;i++)
		if(x%i==0)return i;
	return x;
}

int main()
{
	long long n;
	vis[2]=true;isp[2]=true;
	while(cin>>n)
	{
		if(n==1||isPrime(n))
		{
			cout<<1<<endl<<0<<endl;
			continue;
		}
		int res=find(n);
		if(check(n))
			cout<<2<<endl;
		else if(res>0)
			cout<<1<<endl<<res<<endl;
		else
			cout<<1<<endl<<getDiv(n)<<endl;
	}
	return 0;
}


/*
 * =====================================================================================
 *
 *       Filename:  codeforce.cpp
 *
 *    Description:
 *
 *        Version:  1.0
 *        Created:  02/17/2012 10:59:16 PM
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  ronaflx
 *        Company:  hit-ACM-Group
 *
 * =====================================================================================
 */
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <climits>
#include <algorithm>
#include <iterator>
#include <functional>
#include <limits>
#include <numeric>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <list>
#include <string>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <iterator>
#include <stdexcept>
#include <utility>
#include <cassert>
#include <complex>
using namespace std;
#define LEFT(i) ((i) << 1)
#define RIGHT(i) (((i) << 1) | 1)
#define MID(i) ((l[i] + r[i]) >> 1)
#define CC(i, v) memset(i, v, sizeof(i))
#define REP(i, l, n) for(int i = l;i < int(n);++i)
#define FOREACH(con, i) for(__typeof(con.begin()) i = con.begin();i != con.end();++i)
template<class T>bool checkmax(T &a,T b){return a < b ? a = b, 1 : 0;}
template<class T>bool checkmin(T &a,T b){return a > b ? a = b, 1 : 0;}
typedef long long LL;
typedef pair<int, int> PII;
template<class T> void string_reader(string s, vector<T>& vec){
	istringstream sin(s);
	copy(istream_iterator<T>(sin), istream_iterator<T>(), back_inserter(vec));
}
const LL N = 4000000;
bool tags[N];
vector<LL> prime;
int main()
{
	memset(tags, true, sizeof(tags));
	tags[0] = tags[1] = 0;
	prime.reserve(N / 10);
	for(LL i = 2;i < N;i++)
	{
		if(!tags[i]) continue;
		for(LL j = 2;j * i < N;j++)
		{
			tags[i * j] = 0;
		}
		prime.push_back(i);
	}
	LL n;
	while(cin >> n)
	{
		LL now = 1, tms = 0;
		FOREACH(prime, i)
		{
			while(n % (*i) == 0)
			{
				n /= *i;
				if(tms < 2) now *= *i;
				tms++;
			}
		}
		if(tms == 0)
			cout << 1 << endl << 0 << endl;
		else if(tms != 2)
			cout << 1 << endl << now << endl;
		else
			cout << 2 << endl;
	}
	return 0;
}


/*
 * =====================================================================================
 *
 *       Filename:  codeforce.cpp
 *
 *    Description:
 *
 *        Version:  1.0
 *        Created:  02/17/2012 10:59:16 PM
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  ronaflx
 *        Company:  hit-ACM-Group
 *
 * =====================================================================================
 */
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <climits>
#include <algorithm>
#include <iterator>
#include <functional>
#include <limits>
#include <numeric>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <list>
#include <string>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <iterator>
#include <stdexcept>
#include <utility>
#include <cassert>
#include <complex>
using namespace std;
#define LEFT(i) ((i) << 1)
#define RIGHT(i) (((i) << 1) | 1)
#define MID(i) ((l[i] + r[i]) >> 1)
#define CC(i, v) memset(i, v, sizeof(i))
#define REP(i, l, n) for(int i = l;i < int(n);++i)
#define FOREACH(con, i) for(__typeof(con.begin()) i = con.begin();i != con.end();++i)
template<class T>bool checkmax(T &a,T b){return a < b ? a = b, 1 : 0;}
template<class T>bool checkmin(T &a,T b){return a > b ? a = b, 1 : 0;}
typedef long long LL;
typedef pair<int, int> PII;
template<class T> void string_reader(string s, vector<T>& vec){
	istringstream sin(s);
	copy(istream_iterator<T>(sin), istream_iterator<T>(), back_inserter(vec));
}
const LL N = 4000000;
bool tags[N];
vector<LL> prime;
int main()
{
	memset(tags, true, sizeof(tags));
	tags[0] = tags[1] = 0;
	prime.reserve(N / 10);
	for(LL i = 2;i < N;i++)
	{
		if(!tags[i]) continue;
		for(LL j = 2;j * i < N;j++)
		{
			tags[i * j] = 0;
		}
		prime.push_back(i);
	}
	LL n;
	while(cin >> n)
	{
		int now = 1, tms = 0;
		if(find(prime.begin(), prime.end(), n) != prime.end() || n == 1)
			cout << 1 << endl << 0 << endl;
		else
		{
			FOREACH(prime, i)
			{
				while(tms != 2 && n % (*i) == 0)
				{
					n /= *i;
					now *= *i;
					tms++;
				}
				if(tms == 2) break;
			}
			if(tms == 2 && n != 1)
				cout << 1 << endl << now << endl;
			else
				cout << 2 << endl;
		}
	}
	return 0;
}