/*
kaafi fucked up
*/
#define SET

#pragma GCC optimize("O3")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")

#define DEBUG

#include <bits/stdc++.h>
#include <string>
#define pb push_back
#define mp make_pair
#define f(i, a, b) for (long long i = a; i < b; i++)
#define revf(i, b, a) for (int i = b; i >= a; i--)
#define srt(v) sort(v.begin(), v.end())
#define rev_srt(v) sort(v.rbegin(), v.rend())
#define mem(a, b) memset(a, b, sizeof(a))
using namespace std;

#ifdef SET
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
using namespace __gnu_pbds;
using namespace __gnu_cxx;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_multi_set;

#endif

#define nl '\n'
#define sp " "
#define precision(x) cout << fixed << setprecision(x);
#define fio                  \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);
#define all(x) x.begin(), x.end()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;

template <typename T>
void debugv(vector<T> a)
{
#ifdef DEBUG
    for (auto i : a)
    {
        cout << i << sp;
    }
    cout << nl;
    return;
#endif
    return;
}

template <typename T>
void debuga(T *a, int n, int beg = 0)
{
#ifdef DEBUG
    f(i, beg, beg + n)
    {
        cout << a[i] << sp;
    }
    cout << nl;
    return;
#endif
    return;
}

void logg(string s)
{
#ifdef DEBUG
    cout << s << nl;
#endif
}

template <class T>
inline bool remax(T &a, T b)
{
    return a < b ? a = b, 1 : 0;
}
template <class T>
inline bool remin(T &a, T b)
{
    return a > b ? a = b, 1 : 0;
}

ll md = 1000000007;
// const ll MXSZ= (ll)5e5;
// ll fact[MXSZ];
// ll mi[MXSZ];

// ll my_gcd(ll n, ll m)
// {
//     if (n % m == 0)
//         return m;
//     if (n < m)
//         swap(n, m);
//     while (m > 0)
//     {
//         n = n % m;
//         swap(n, m);
//     }
//     return n;
// }

ll pw(ll a, ll b)
{
    ll c = 1, m = a % md;
    while (b)
    {
        if (b & 1)
            c = (c * m) % md;
        m = (m * m) % md;
        b /= 2;
    }
    return c;
}

ll modinv(ll n)
{
    return pw(n, md - 2);
}

inline ll add(ll a, ll b)
{
    return (md + a % md + b % md) % md;
}
inline ll subt(ll a, ll b)
{
    return (a % md - b % md + md) % md;
}
inline ll mult(ll a, ll b)
{
    return (1ll * (a % md) * (b % md)) % md;
}

// ll ncr(int n, int r)
// {
//     if (!n)
//         return 1;
//     return mult(fact[n], mult(mi[r], mi[n - r]));
// }

// void pre()
// {
//     fact[0] = 1;
//     ll lim = MXSZ;
//     f(i, 1, lim) fact[i] = mult(i, fact[i - 1]);

//     f(i, 0, lim) mi[i] = modinv(fact[i]);
//     // f(i, 0, 10) cout << mi[i] << sp;
//     // cout << nl;
// }
template <class T>
T myceil(T a, T b)
{
    if (a % b)
        return (a / b) + 1;
    else
        return a / b;
};

const ll MX = 3e2 + 20;

double dp[MX][MX][MX];
double pathProb[MX][MX][MX];
ll a[MX];
ll cnt[4];
ll n;
ll n1, n2, n3, nt;
bool validate(ll x, ll y, ll z)
{
    if (x < 0 || y < 0 || z < 0)
        return 0;
    if (z > n3)
        return 0;
    if (y > (n2 + (n3 - z)))
        return 0;
    if (x > (n1 + n2 + n3 - (y + z)))
        return 0;
    if (x + y + z > nt)
        return 0;
    return 1;
}

void solvetestcase(ll tcn)
{
    cin >> n;
    f(i, 0, n) cin >> a[i], cnt[a[i]]++;
    n1 = cnt[1];
    n2 = cnt[2];
    n3 = cnt[3];
    nt = n1 + n2 + n3;
    pathProb[n1][n2][n3] = 1;
    revf(z, n3, 0)
    {
        revf(y, n2 + (n3 - z), 0)
        {
            revf(x, nt - (z + y), 0)
            {
                if (validate(x + 1, y, z))
                {
                    double p_x = double(x + 1) / double(x + y + z + 1);
                    pathProb[x][y][z] += pathProb[x + 1][y][z] * p_x;
                }
                if (validate(x - 1, y + 1, z))
                {
                    double p_y = double(y + 1) / double(x + y + z);
                    pathProb[x][y][z] += pathProb[x - 1][y + 1][z] * p_y;
                }
                if (validate(x, y - 1, z + 1))
                {
                    double p_z = double(z + 1) / double(x + y + z);
                    pathProb[x][y][z] += (pathProb[x][y - 1][z + 1] * p_z);
                }


                if (validate(x + 1, y, z))
                {
                    double tr_x = (double(x + 1) * double(nt)) / double((x + y + z + 1) * (x + y + z + 1));
                    double p_x = double(x + 1) / double(x + y + z + 1);
                    tr_x/=p_x;
                    double mmm = (pathProb[x + 1][y][z] * p_x)/pathProb[x][y][z];
                    dp[x][y][z] += (dp[x + 1][y][z]*mmm + tr_x*mmm);
                    //cout << "x" << sp << tr_x << sp << p_x << endl;
                }
                if (validate(x - 1, y + 1, z))
                {
                    double tr_y = (double(y + 1) * double(nt)) / double((x + y + z) * (x + y + z));
                    double p_y = double(y + 1) / double(x + y + z);
                    tr_y/=p_y;
                    double mmm= (pathProb[x - 1][y + 1][z] * p_y)/pathProb[x][y][z];
                    dp[x][y][z] += (dp[x - 1][y + 1][z]*mmm + tr_y*mmm);
                    //cout << "y" << sp << tr_y << sp << p_y << endl;
                }
                if (validate(x, y - 1, z + 1))
                {
                    double tr_z = (double(z + 1) * double(nt)) / double((x + y + z) * (x + y + z));
                    double p_z = double(z + 1) / double(x + y + z);
                    tr_z/=p_z;
                    double mmm= (pathProb[x][y - 1][z + 1] * p_z)/pathProb[x][y][z];
                    dp[x][y][z] += (dp[x][y - 1][z + 1]*mmm+ tr_z*mmm  );
                    //cout << "z" << sp << tr_z << sp << p_z << endl;
                }
                //cout << z << sp << y << sp << x << sp << dp[x][y][z] << endl;
            }
        }
    }
    precision(12);
    cout << dp[0][0][0];//<<sp<<pathProb[0][0][0]<<endl;
}

int main()
{
    fio;
    int t = 1;
    //cin >> t;
    //pre();
    f(i, 1, t + 1)
    {
        //cout << "Case #" << i << ": ";
        solvetestcase(i);

        //cout << nl;
    }
    return 0;
};

Measured memory_bytes: 232664