#include <bits/stdc++.h>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
//#define int ll
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector< vvi > vvvi;
typedef vector<short> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<ld> vld;
typedef vector<vld> vvld;
typedef vector<vvld> vvvld;
typedef vector<string> vst;
typedef vector<vst> vvst;
typedef pair<ld, ld> pld;
typedef complex<double> base;

#define inmin(a, b) a = min(a, (b))
#define inmax(a, b) a = max(a, (b))
#define mp(a,b) make_pair(a,b)
#define modsum(a, b) ((a) + (b) >= M ? (a) + (b) - M : (a) + (b))
#define modsubtract(a, b) ((a) - (b) < 0 ? (a) - (b) + M : (a) - (b))
#define modmultiply(a, b) (((a) * (b)) % M)
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define sqr(x) ((x) * (x))
#define fori(i, n) for(int i = 0; i < int(n); ++i)
#define cint const int &
#define SZ(a) ((int)((a).size()))
#define watch(x) cout << (#x) << " = " << (x) << endl;

const double PI = 2 * acos(0.0);

const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";


inline void transpose(vector<string> &a) {

    int n = a.size();
    if (n == 0) return;
    int m = a[0].size();
    vector<string> b(m, string(n, ' '));
    fori (i, n) fori (j, m) b[j][i] = a[i][j];
    a = b;
}


template<class T>
inline ostream & operator << (ostream &out, vector<T> &a) {
    out << "{";
    fori (i, SZ(a))
        out << a[i] << vector<string>{", ", "}"}[i + 1 == SZ(a)];
    return out;
}

void smain();

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);


#ifdef MAX_HOME
    freopen("input.txt", "r", stdin);
    clock_t start = clock();
#define cerr cout
#endif
    cout << setprecision(12) << fixed;
    smain();
#ifdef MAX_HOME
    cout << "\n\n\n\n";
    cout << "TOTAL EXECUTION TIME: " << float( clock () - start ) /  CLOCKS_PER_SEC << endl;
#endif
}


const int N = 309;
ld dp[N][N][N];
char did[N][N][N];
int n;
ld get_dp(int i, int j, int k) {
    if (i + j + k == 0) return 0;
    if (did[i][j][k]) return dp[i][j][k];
    int zeros = n - i - j - k;
    if (zeros < 0) assert(0);
    ld p0 = (ld) zeros / n;
    ld p1 = (ld) i / n;
    ld p2 = (ld) j / n;
    ld p3 = (ld) k / n;
    ld cur = 0;
    if (i) cur += get_dp(i - 1, j + 1, k) * p1;
    if (j) cur += get_dp(i, j - 1,k + 1) * p2;
    if (k) cur += get_dp(i, j, k - 1) * p3;
    if (zeros) dp[i][j][k] = (1.0 + cur) / (1.0 - p0);
    else dp[i][j][k] = 1.0 + cur;
    did[i][j][k] = 1;
//    cerr << "dp[" << i << "][" << j << "][" << k << "] = " << dp[i][j][k] << endl;
    return dp[i][j][k];
}

void smain() {

    cin >> n;

//    fori (i, n + 1) fori (j, n + 1) fori (k, n + 1) {
//        if (i + j + k == 0) continue;
//        int zeros = n - i - j - k;
//        if (zeros < 0) continue;
//        ld p0 = (ld) zeros / n;
//        ld p1 = (ld) i / n;
//        ld p2 = (ld) j / n;
//        ld p3 = (ld) k / n;
//        ld cur = 0;
//        if (i) cur += dp[i - 1][j][k] * p1;
//        if (j) cur += dp[i][j - 1][k] * p2;
//        if (k) cur += dp[i][j][k - 1] * p3;
//        if (zeros) dp[i][j][k] = (1.0 + cur) / (1.0 - p0);
//        else dp[i][j][k] = 1.0 + cur;
//        cerr << "dp[" << i << "][" << j << "][" << k << "] = " << dp[i][j][k] << endl;
//    }
    int i = 0, j = 0, k = 0;
    for (int iter = 0; iter < n; ++iter) {
        int a;
        cin >> a;
        i += (a == 3);
        j += (a == 2);
        k += (a == 1);
    }

    cout << get_dp(i, j, k);
}

Measured memory_bytes: 477440