import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

enum inf = 10L^^18;
enum mod = 10L ^^ 9 + 7;

void main() {
    int n;
    scan(n);
    auto a = readln.split.to!(int[]);

    auto c = new int[](3);
    foreach (i ; 0 .. n) {
        c[a[i]-1]++;
    }

    auto dp = new double[][][](n + 1, n + 1, n + 1);
    fillAll(dp, -1);

    double dfs(int i, int j, int k) {
        auto v = &dp[i][j][k];
        if (i + j + k == 0) {
            return 0;
        }
        if (*v != -1) {
            return *v;
        }
        *v = 0;
        if (i) {
            *v += 1.0 * i * dfs(i-1, j, k);
        }
        if (j) {
            *v += 1.0 * j * dfs(i+1, j-1, k);
        }
        if (k) {
            *v += 1.0 * k * dfs(i, j+1, k-1);
        }
        *v += n;
        *v /= (i + j + k);
        return *v;
    }

    auto ans = dfs(c[0], c[1], c[2]);

    writefln("%.12f", ans);
}







void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}


void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}