#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
const ll mod = 1000000007;
vector<ll>:: iterator it1;
ll gc(ll a,ll b)
{
    if(b==0) return a;
    return gc(b,a%b);
}

vector<bool>prime(100005,true);
vector<ll>v;
void sieve(ll n)
{
    prime[1]=false;
   for (int p=2; p*p<=n; p++)
    {
        // If prime[p] is not changed, then it is a prime
        if (prime[p] == true)
        {
            // Update all multiples of p greater than or
            // equal to the square of it
            // numbers which are multiple of p and are
            // less than p^2 are already been marked.
            for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }

    for(int i=2;i<=n;i++)
    {
        if(prime[i]==true)
            v.push_back(i);
    }
}

bool comp(pair<ll,ll> &p1, pair<ll,ll> &p2)
{
    return (p1.second<p2.second);
}
int BIT[1000];
void update(int x, int delta)
{
    int n;
      for(; x <= n; x += x&-x)
        BIT[x] += delta;
}
int query(int x)
{
     int sum = 0;
     for(; x > 0; x -= x&-x)
        sum += BIT[x];
     return sum;
}

vector<vector<ll> >dp(30005,vector<ll>(248,-1));
map<ll,ll>m;
ll recur(ll cur,ll pre, ll n)
{
    if(cur>n) return 0;
    ll len=cur-pre;
    if(dp[cur][len]!=-1) return dp[cur][len];
    ll temp=0;
    temp+=m[cur];
    if(len==1)
         temp+=max(recur(cur+len-1,cur,n),recur(cur+len+1,cur,n));
    else temp+=max(recur(cur+len-1,cur,n), max(recur(cur+len,cur,n),recur(cur+len+1,cur,n)));
    dp[cur][len]=temp;
    return temp;
}
ll ans=0;
void dfs(ll src, ll p, vector<ll> adj[], vector<ll> & a,ll m, ll check,ll pre, ll counter)
{
    if(counter!=0 && adj[src].size()==1)
    {
      if(a[src]==1)
      check=max(check,pre+1);
      else
        check=max(check,pre);
      if(check<=m)
            ans++;
      return;
    }

    for(int i=0;i<adj[src].size();i++)
    {
     if(adj[src][i]!=p)
     {
         if(a[src]==1)
         {
             check=max(check,pre+1);
             if(check>m) return;
         dfs(adj[src][i],src, adj,a,m,check,pre+1,counter+1);
         }
         else
         {
             dfs(adj[src][i],src, adj,a,m,check,0,counter+1);
         }
     }
    }
}
void lcs()
{
vector<int> d;
int ans, n;
 for (int i = 0; i < n; i++) {
        int x;
        scanf("%d", &x);
        vector<int>::iterator it = upper_bound(d.begin(), d.end(), x);
        if (it == d.end()) d.push_back(x);
        else *it = x;
    }
    printf("LIS = %d", d.size());
}
ll find(ll u, vector<ll>& parent)
{
    if(u==parent[u]) return u;
    else return parent[u]=find(parent[u],parent);
}
 void unio(ll u, ll v, vector<ll>& parent, vector<ll>& ran)
{
    u=find(u,parent);
    v=find(v,parent);
    if(u==v) return;
    if(ran[u]>=ran[v])
    {
        parent[v]=u;
        ran[u]+=v;
    }
    else{
        parent[u]=v;
        ran[v]+=u;
    }
}
ll dfs(ll src,ll p, vector<ll> adj[],vector<ll>& sz)
{
    sz[src]=1;
    for(int i=0;i<adj[src].size();i++)
    {
        ll v=adj[src][i];
        if(v==p) continue;
        sz[src]+=dfs(v, src,adj,sz);
    }
    return sz[src];
}
ll dfs1(ll src,ll p, vector<ll> adj[], vector<ll> & dp, ll m)
{
    dp[src]=1;
    for(int i=0;i<adj[src].size();i++)
    {
        ll v=adj[src][i];
        if(v==p) continue;
        ll temp=1;
        temp=dfs1(v,src,adj,dp,m);
        dp[src]=((dp[src]%m)*(temp%m));
    }
    return dp[src]+1;
}
void dfs2(ll src , ll p, vector<ll> adj[], vector<ll> & dp, vector<ll>& ans, ll m)
{
    ans[src]=dp[src];
    for(int i=0;i<adj[src].size();i++)
    {
        ll v=adj[src][i];
        if(v==p) continue;
        dp[src]/=(dp[v]+1);
        dp[v]=((dp[v]%m)*(dp[src]+1)%m)%m;
        dfs2(v,src,adj,dp,ans,m
             );
        dp[v]/=(dp[src]+1);
        dp[src]=((dp[src]%m)*(dp[v]+1)%m);
    }
    return;
}

inline ll add(ll a,ll b) {return ((a%mod)+(b%mod))%mod;}
inline ll sub(ll a,ll b) {return ((a%mod)-(b%mod)+mod)%mod;}
inline ll mul(ll a,ll b) {return ((a%mod)*(b%mod))%mod;}
ll dfs1(vector<ll> adj[], ll src, ll p,ll col, vector<ll>& dp)
{
    dp[src]=1;
    for(int i=0;i<adj[src].size();i++)
    {
        ll v=adj[src][i];
        if(v==p) continue;
        ll st=dfs1(adj, v,src, 1,dp);
        if(col==1)
        {
            ll temp=0;
            temp=add(temp,dfs1(adj,v,src,0,dp));
            temp=add(temp,st);
            dp[src]=mul(dp[src],temp);
        }
        else
        {
            dp[src]=mul(dp[src],st);
        }

    }
    return dp[src];
}
ll recur(ll idx, vector<ll>& a, ll n, ll k, vector<vector<ll> >& dp)
{
    if(k==0) return 1;
    if(k<0) return 0;
    if(idx==n) return 0;
    if(dp[idx][k] !=-1) return dp[idx][k];
    ll temp=a[idx];
    ll ans=0;
    for(int i=0;i<=min(temp,k);i++)
    {
        ans=add(ans,recur(idx+1,a,n,k-i,dp));
    }
    dp[idx][k]=ans;
    return ans;
}
double dp1[303][303][303];
ll n;
double f(int a,int b,int c)
{
    if(dp1[a][b][c]!=-1)
        return dp1[a][b][c];
    int res=a+b+c;
    if(!res)
    return 0;
    double ans=0;
    if(a)
    ans+=(a*f(a-1,b,c)*(1.0))/(a+b+c);
    if(b)
    ans+=(b*f(a+1,b-1,c)*(1.0))/(a+b+c);
    if(c)
    ans+=(c*f(a,b+1,c-1)*(1.0))/(a+b+c);
    ans+=(n*(1.0))/(a+b+c);
    return dp1[a][b][c]=ans;
}
int main()
{
    cin>>n;
    int a=0,b=0,c=0;
    for(int i=0;i<n;i++)
    {
        int t;
        cin>>t;
        if(t==1)
        a++;
        if(t==2)
        b++;
        if(t==3)
        c++;
    }
    for(int i=0;i<303;i++)
        for(int j=0;j<303;j++)
            for(int k=0;k<303;k++)
                dp1[i][j][k]=-1;
    cout<<setprecision(10)<<f(a,b,c);

return 0;
}

Measured memory_bytes: 276992