#include<iostream>
#include<cstdio>
#include<ctime>
#include<cstdlib>
#include<cmath>
#define ll long long
#define N 100005

struct P{int x,y,w;}p[N];

ll n;

double ansx,ansy;

inline  double find(double x){
	double ans = 0;
	for(int i = 1;i <= n;++i)
	ans += (p[i].x + x - std::min((double)p[i].x,(double)(2 * x))) / (1.0 * n);
	return ans;
}

int main(){
//	freopen("q.in","r",stdin);
//	freopen("q.out","w",stdout);
	srand(273352);
	scanf("%lld",&n);
	for(int i = 1;i <= n;++i){
		scanf("%d",&p[i].x);
		ansx += p[i].x;	}
	ansx = (ansx) / (1.0 * n);
	ansy = 0x7f7f7f7f;
	double eps = 1e-15;
	double T = 200;//初始温度 
	while(T > eps && ((double)(clock())/CLOCKS_PER_SEC)<1.9){//终止态 
//		std::cout<<T<<" "<<(rand() * 2 - RAND_MAX) * T<<std::endl;
		double nowx = ansx + ((rand() * 2 - RAND_MAX + 1) * T);//在值域[ansx - t,ansx + t];中挑选一个随机数
		long double z = find(nowx) - find(ansx);
		if(z < 0)
		ansx = nowx,ansy = std::min(ansy,find(nowx));
		else
		if(exp(-z / T) * RAND_MAX > rand())//随机接受 
		ansx = nowx;
		T *= 0.997;//降温速率 
//		std::cout<<ansx<<std::endl;
	}
	printf("%.12lf\n",ansy);
}

#include<bits/stdc++.h>
#define For(i,j,k)  for(int i=j;i<=k;++i)
#define Dow(i,j,k)  for(int i=k;i>=j;--i)
#define ll long long
#define pb push_back
#define fir first
#define sec second
#define pb push_back
#define pa pair<int,int>
#define mk make_pair
 
using namespace std;
 
inline ll read()
{
    ll t=0,dp=1;char c=getchar();
    while(!isdigit(c))  {if(c=='-') dp=-1;c=getchar();}
    while(isdigit(c))   t=t*10+c-48,c=getchar();
    return t*dp;
}
inline void write(ll x){if(x<0)  {putchar('-');x=-x;}    if(x>=10)    write(x/10);putchar(x%10+48);}
inline void writeln(ll x){write(x);puts("");}
inline void write_p(ll x){write(x);putchar(' ');}
int main()
{
	ll N=read();
	ll f[233];
	ll x=0,y=0;
	f[0]=1;f[1]=2;
	int tot=1;
	For(i,2,100)
	{
		f[i]=f[i-1]+f[i-2];
		if(f[i]>N)	break;
		tot=i;
	}
	int top=0;
	int q[233];
	Dow(i,0,tot)
	{
		if(f[i]<=N)	q[++top]=i,N-=f[i];
	}
	reverse(q+1,q+top+1);
	int now=3;
	int tep=1;
	int ans[233],top_ans=0;
	For(i,1,tot+1)
	{
		ans[++top_ans]=now;
		if(now==3)	x=x+y;
		if(now==4)	y=x+y;
		if(q[tep]==i-1)
		{
			if(now==4)	ans[++top_ans]=1;
			else	ans[++top_ans]=2;
			++tep;
		}
		now=7-now;
	}	
	writeln(top_ans);
	x=y=0;
	Dow(i,1,top_ans)
	{
		writeln(ans[i]);
		if(ans[i]==1)	x++;
		if(ans[i]==2)	y++;
		if(ans[i]==3)	x=x+y;
		if(ans[i]==4)	y=x+y;
	}
	// cout<<tot<<' '<<f[tot]<<endl;
	// cout<<x<<"=="<<y<<endl;
}
/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
	* DON'T GET STUCK ON ONE APPROACH
	-- Benq
*/