#include <bits/stdc++.h>
#ifdef __LOCAL
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

#ifdef __LOCAL
    #include <filesystem>
    namespace fs = std::filesystem;
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) os << "[" << el.first << " " << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) os << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int N;
vector<int> A;

void input(){
    fast_io();
    #ifdef __LOCAL
        fs::path p = __FILE__;
        fs::path input,output;
        input = output = p.parent_path();
        input += string("/input/") + string(p.stem()) + string(".txt");
        output += string("/output/") + string(p.stem()) + string(".txt");
        freopen(input.c_str(), "r", stdin);
        freopen(output.c_str(), "w", stdout);
    #endif
    cin >> N;
    for (int i = 0; i < N; i++)
    {
      int a;
      cin >> a;
      A.push_back(a);
    }
    
}

// bool isZero(int x){
//   return x==0;
// }

// int wrong_solve(){
//   int n = accumulate(ALL(A),0);
//   vector<map<vector<int>,double>> dp(n+1);
//   map<vector<int>,int> Count;
//   dp[0][A] = 0;
//   for (int i = 1; i <= n; i++)
//   {
//     for(auto b:dp[i-1]){
//       for (int j = 0; j < N; j++)
//       {
//         vector<int> c = b.first;
//         double d = b.second/Count[c];
//         int m = count_if(ALL(c),isZero);

//         if(c[j]>=1) {
//           c[j]--;
//           Count[c]++;
//           dp[i][c] += (double)(N/(N-m)) + d;
//           }
//       }    
//     }
//   }
//   // DBG(dp)
//   vector<int> zero(N,0);
//   cout << dp[n][zero]/Count[zero] << endl;
//   return 0;
// }

double dp[310][310][310];

double rec(int i, int j, int k){
  if(i<0 || j<0 || k<0) return 0;
  if(i<0 && j<0 && k<0) return 0;
  if(dp[i][j][k]!=0) return dp[i][j][k];
  if(i>=1) dp[i][j][k] += rec(i-1,j,k)  +(double)1/i;
  if(j>=1) dp[i][j][k] += rec(i+1,j-1,k)+(double)1/j;
  if(k>=1) dp[i][j][k] += rec(i,j+1,k-1)+(double)1/k;
  return dp[i][j][k];
}

int solve(){
  int cnt[5];
  memset(cnt,0,sizeof(cnt));
  memset(dp,0,sizeof(dp));
  dp[0][0][0] = 0;
  for(auto a:A) cnt[a]++;

  for (int l = 1; l <= N; l++)
  for (int i = l; i >=0 ; i--)
  for (int j = l; j >=0 ; j--)
  // for (int k = 0; k <= 300; k++)
      {
        int k = l-(i+j);
        if(k<0) continue;
        if(i==0 && j==0 && k==0) continue;
        if(i+j+k>N) continue;
        double s = i+j+k;
        if(i>=1) dp[i][j][k] += (double)i/s*dp[i-1][j][k];
        if(j>=1) dp[i][j][k] += (double)j/s*dp[i+1][j-1][k];
        if(k>=1) dp[i][j][k] += (double)k/s*dp[i][j+1][k-1];
        dp[i][j][k] += (double)N/s;
        // if(1)    dp[i+1][j][k]   += (double)N/(i+1)+dp[i][j][k];
        // if(i>=1) dp[i-1][j+1][k] += (double)N/(j+1)+dp[i][j][k];
        // if(j>=1) dp[i][j-1][k+1] += (double)N/(k+1)+dp[i][j][k];
      } 
  // cout << rec(cnt[1],cnt[2],cnt[3]) << endl;
  cout << fixed << setprecision(10) << dp[cnt[1]][cnt[2]][cnt[3]] << endl;
  return 0;
}

int main()
{
    input();
    solve();
    return 0;
}


Measured memory_bytes: 232960