/***************************************** START OF TEMPLATE *********************************************/
#include<bits/stdc++.h>

using namespace std;

#define  SPEED          ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(15);
#define  randomINIT     mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define  foo(i,a,n)     for(ll i = (a); i <= n; i++)
#define  frr(i,a,n)     for(ll i = (a); i >= n; i--)
#define  fo(i,n)        for(ll i = 0; i < n; i++)
#define  newl           cout<<"\n";
#define  f              first
#define  s              second
#define  pb             push_back
#define  mp             make_pair
#define  sym(s)         s="#"+s+"#";
#define  all(x)         (x).begin(),(x).end()
#define  alll(x, n)     x+1, x+n+1
#define  ll             long long
#define  ld             double
#define  pll            pair<ll,ll>
#define  vll            vector<ll>
#define  vpll           vector<pll>

const ld   PI    =  3.14159265358979323846;
const ll   MOD   =  1e+9 + 7;
const ll   INF   =  LLONG_MAX;
const int  INFi  =  INT_MAX;
const ll   N     =  3e+2 + 8;

void _print() {cout << "";}
void __print(int x) {cout << x;}
void __print(long long x) {cout << x;}
void __print(float x) {cout << x;}
void __print(double x) {cout << x;}
void __print(long double x) {cout << x;}
void __print(const char *x) {cout << '\"' << x << '\"';}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const string &x) {cout << '\"' << x << '\"';}
template<typename T, typename V> void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T> void __print(const T &x) {int f = 0; cout << '{'; for (auto &i : x) cout << (f++ ? ", " : ""), __print(i); cout << "}";}
template<typename T, typename... V> void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
template<typename T1, typename T2> void mset(T1 &x, T2 val) {memset(x, val, sizeof(x));}
template<typename T1, typename T2> void mset(T1 &a, ll n, T2 v) {foo(i, 0, n)a[i] = v;}
template<typename T1, typename T2> void mset(T1 &a, ll n, ll m , T2 v) {foo(i, 0, n)foo(j, 0, m)a[i][j] = v;}
template<typename T1>void OUT(T1 a[], ll n, ll m) {foo(i, 1, n) {foo(j, 1, m) {cout << a[i][j] << " ";} newl;}}
void OUT(ll a[], ll n) {foo(i, 1, n) cout << a[i] << " "; newl;}
void OUT(pll a[], ll n) {foo(i, 1, n) __print(a[i]); newl;}
#define  debug(x...)    _print(x);newl;


vll adj[N]; ll vis[N];
ll dx4[] = {0, 1, 0, -1}, dy4[] = {1, 0, -1, 0};

ll test_cases = 1; randomINIT;

/*********************************************************************************************************/
/***************************************** VARIABLE DECLARATIONS *****************************************/
ll n, x;
ld dp[N][N][N];


/***************************************** FUNCTION IMPLEMENTATIONS **************************************/
ld solve(ll f1, ll f2, ll f3) {
    if (f1 < 0 || f2 < 0 || f3 < 0)  return 0;
    if (f1 == 0 && f2 == 0 && f3 == 0) return 0;
    if (dp[f1][f2][f3] > 0)return dp[f1][f2][f3];
    ld ans = n  + f1 * solve(f1 - 1, f2, f3) + f2 * solve(f1 + 1, f2 - 1, f3) + f3 * solve(f1, f2 + 1, f3 - 1);
    return dp[f1][f2][f3] = ans / (f1 + f2 + f3);
}


/***************************************** START OF MAIN FUNCTION ****************************************/
void MAIN(ll tc) {
    ll c1 = 0, c2 = 0, c3 = 0;
    cin >> n;
    foo(i, 1, n) {
        cin >> x;
        if (x == 1)c1++;
        else if (x == 2)c2++;
        else c3++;
    }

    mset(dp, -1);
    cout << solve(c1, c2, c3);

}

int main() {
    SPEED;

    //cin>>test_cases;
    foo(i, 1, test_cases) {
        MAIN(i);
    }
}

Measured memory_bytes: 228608