#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
typedef long long int ld;
typedef unsigned long long int lu;
typedef vector< int > vi;
typedef vector < ld > vd;
typedef set <ld> sd;
typedef vector< vi > vvi;
typedef vector< vd > vvd;
typedef pair< int,int > ii;
typedef pair< ld,ld > id;
#define sz(a) ld((a).size())
#define test(t) ll t;cin>>t;while(t--)
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define Vi vector
#define pr pair
#define mpr make_pair
#define fi first
#define se second
#define isnum(a) (a>=48 && a<=57)
#define isS(a) (a>='a' && a<='z')
#define isU(a) (a>='A' && a<='Z')
#define toS(a) (isU(a)?a+32:a)
#define toU(a) (isS(a)?a-32:a)
#define toC(a) a&15

set <ld> s[100005];
ld d[100005];

vector<char> prime (100000+1, true);
void sieve(ld n)
{	
	//O(nloglogn) time
	prime[0] = prime[1] = false;
	for (ld i=2; i<=n; ++i)
	{
		if (prime[i])
		{
			s[i].insert(i);			
			for (ld j=2*i; j<=n; j+=i)
			{
				prime[j] = false;
				s[j].insert(i);
			}
		}
	}
}
#define forn(i,e) for(int i = 0; i < e; i++)
#define rep(i,a,b) for(i=a;i<b;i++)
#define REP(i,a,b) for(i=a;i<=b;i++)
#define reprev(i,a,b) for(i=a;i>=b;i--)

#define leadzero(a) __builtin_clz(a) //count leading zeros
#define trailzero(a) __builtin_ctz(a) //count trailing zeros
#define bitcount(a) __builtin_popcount(a) // count set bits (add ll)
#define ln cout<<"\n"
#define sp cout<<" "
#define maxe(a) *max_element(a.begin(),a.end())
#define maxi(a) max_element(a.begin(),a.end())-a.begin()
#define mine(a) *min_element(a.begin(),a.end())
#define mini(a) min_element(a.begin(),a.end())-a.begin()
ld gcd(ld a, ld b) { if(b == 0) return a; return gcd(b, a % b); }
ld fastpowMOD(ld a, ld p,ld MOD){ if(p==0) return 1; ld z = fastpowMOD(a,p/2,MOD); z = (z*z)%MOD; if(p%2) z = (z*a)%MOD; return z; }
ld fastpow(ld a, ld p){ if(p==0) return 1; ld z = fastpow(a,p/2); z = (z*z); if(p%2) z = (z*a); return z; }
ld a,b;

ld search1(ld a[], ld f,ld n)
{
	ld left=1;
	ld right=n+1;
	while(right-left>1)
	{
		ld mid = left + (right-left)/2;
		if(a[mid]<f)
		{
			left=mid;
		}
		else right=mid;
	}
	return a[left];
}
long double dp[301][301][301];
bool br[301][301][301];
long double getx(ld cnt1,ld cnt2,ld cnt3,ld n)
{
	if(br[cnt1][cnt2][cnt3])return dp[cnt1][cnt2][cnt3];
	dp[cnt1][cnt2][cnt3] += ((long double)n)/(cnt1+cnt2+cnt3);
	//cout << ((double)n)/(cnt1+cnt2+cnt3) << " "; 
	if(cnt1>0)dp[cnt1][cnt2][cnt3] += getx(cnt1-1,cnt2,cnt3,n)*((long double)cnt1/(cnt1+cnt2+cnt3));
	if(cnt2>0)dp[cnt1][cnt2][cnt3] += getx(cnt1+1,cnt2-1,cnt3,n)*((long double)cnt2/(cnt1+cnt2+cnt3));
	if(cnt3>0)dp[cnt1][cnt2][cnt3] += getx(cnt1,cnt2+1,cnt3-1,n)*((long double)cnt3/(cnt1+cnt2+cnt3));
	br[cnt1][cnt2][cnt3]=true;
	return dp[cnt1][cnt2][cnt3];
}

int main(){
	ld n;
	cin >> n;
	fixed;
	setprecision(20);
	ld a[n];
	ld i,j;
	memset(dp,0.0,sizeof(dp));
	memset(br,0,sizeof(br));
	//cout << dp[1][0][0] << endl;
	ld cnt1,cnt2,cnt3;
	dp[0][0][0]=0.0;
	br[0][0][0]=1;
	cnt1=0;
	cnt2=0;
	cnt3=0;
	rep(i,0,n)
	{
		cin >> a[i];
		if(a[i]==1)cnt1++;
		else if(a[i]==2)cnt2++;
		else cnt3++;
	}

	dp[cnt1][cnt2][cnt3] = getx(cnt1,cnt2,cnt3,n);
	//cout << dp[3][0][0] << " " << dp[2][0][0] << " " << dp[1][0][0] << " " << dp[0][0][0] << endl; 
	cout << setprecision(20) << dp[cnt1][cnt2][cnt3] << endl;

	return 0;
}

Measured memory_bytes: 458624