#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define repeat(i,n) for (int i = 0; (i) < (n); ++ (i)) #define debug(x) cerr << #x << ": " << x << '\n' #define debugArray(x,n) for(long long hoge = 0; (hoge) < (n); ++ (hoge)) cerr << #x << "[" << hoge << "]: " << x[hoge] << '\n' #define debugArrayP(x,n) for(long long hoge = 0; (hoge) < (n); ++ (hoge)) cerr << #x << "[" << hoge << "]: " << x[hoge].first<< " " << x[hoge].second << '\n' using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair Pii; typedef vector vint; typedef vector vll; const ll INF = LLONG_MAX/10; const ll MOD = 1e9+7; int N; double dp[110][110][110]; int main(){ cin.tie(0); ios::sync_with_stdio(false); cin>>N; int cnt[3]={0}; repeat(i,N){ int A;cin>>A; cnt[2] += A>=3; cnt[1] += A>=2; cnt[0] += A>=1; } for(int i=N;i>=0;i--){ for(int j=i;j>=0;j--){ for(int k=min(j,N-1);k>=0;k--){ dp[i][j][k] = dp[i+1][j][k]*(N-i)/(N-k)+dp[i][j+1][k]*(i-j)/(N-k)+dp[i][j][k+1]*(j-k)/(N-k)+(double)N/(N-k); } } } //debugArray(cnt,3); printf("%.7lf\n",dp[cnt[0]][cnt[1]][cnt[2]]); return 0; }