#include <bits/stdc++.h>
#include <math.h>

using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
using Graph = vector<vector<int>>;
const int MOD = 1000000007;
const int INF_32 = 1LL << 30;
const int64_t INF_64 = 1LL << 60;

template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T& val)
{
    std::fill((T*)array, (T*)(array + N), val);
}

// dp[c1][c2][c3]: (1個の皿がc1枚，2個の皿がc2枚，3個の皿がc3枚の状態ですべて食べるまでの操作回数の期待値)
double dp[305][305][305];
int N;

double rec(int c1, int c2, int c3)
{
    if (dp[c1][c2][c3] != -1.0)
        return dp[c1][c2][c3];

    double ret = N;
    if (c1 >= 1) {
        ret += c1 * rec(c1 - 1, c2, c3);
    }
    if (c2 >= 1) {
        ret += c2 * rec(c1 + 1, c2 - 1, c3);
    }
    if (c3 >= 1) {
        ret += c3 * rec(c1, c2 + 1, c3 - 1);
    }
    ret /= (c1 + c2 + c3);

    return dp[c1][c2][c3] = ret;
}
int main()
{
    cin >> N;
    Fill(dp, -1.0);
    dp[0][0][0] = 0;
    int c1, c2, c3;
    c1 = c2 = c3 = 0;
    for (int i = 0; i < N; i++) {
        int a;
        cin >> a;
        if (a == 1)
            c1++;
        if (a == 2)
            c2++;
        if (a == 3)
            c3++;
    }

    cout << fixed << setprecision(9);
    cout << rec(c1, c2, c3) << endl;

    return 0;
}
#include "bits/stdc++.h"
#define ll long long
#define mp(a, b) make_pair(a, b)
using namespace std;
typedef pair<ll, ll> pairs;
typedef pair<ll, pairs> tpl;
ll c[4];
double dp[301][301][301];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll n, a;
    cin >> n;
    for (ll i = 0; i < n; i++)
        cin >> a, c[a]++;
    dp[0][0][0] = 0;
    for (ll i = 0; i <= n; i++)
    {
        for (ll j = 0; j <= n; j++)
        {
            for (ll k = 0; k <= n; k++)
            {
                double z = n - (i + j + k), val = 1;
                if (z == n)
                    continue;
                if (i + j + k > n)
                    continue;
                if (i > 0)
                    val += (1.0 * i / n) * dp[i - 1][j + 1][k];
                if (j > 0)
                    val += (1.0 * j / n) * dp[i][j - 1][k + 1];
                if (k > 0)
                    val += (1.0 * k / n) * dp[i][j][k - 1];
                if (z > 0)
                    val /= (1.0 - 1.0 * z / n);
                dp[i][j][k] = val;
            }
        }
    }

    cout << setprecision(9) << fixed << dp[c[3]][c[2]][c[1]];
}