#include #include #define rep(i,n) for(ll i=0;i<(n);i++) #define rrep(i,n) for(ll i = 1; i <= (n); ++i) #define drep(i,n) for(ll i = (n)-1; i >= 0; --i) #define srep(i,s,t) for (int i = s; i < t; ++i) #define all(v) v.begin(),v.end() #define len(x) (ll)(x).length() #define maxs(x,y) x = max(x,y) #define mins(x,y) x = min(x,y) #define pb push_back #define pf push_front #define sz(x) (ll)(x).size() #define v(T) vector #define vv(T) vector> using namespace std; using namespace atcoder; typedef long long ll; typedef pair P; typedef vector vi; typedef vector vd; typedef vector vs; typedef vector vvi; typedef vector vl; typedef vector vvl; typedef vector vvd; typedef vector

vp; ll gcd(ll a,ll b){if(a%b==0){return b;}else{return(gcd(b,a%b));}} ll lcm(ll a,ll b){return a/gcd(a,b)*b;} const int INF=1e9; const ll MX = 1e18; const ll mod=INF+7; const int di[] = {-1,0,1,0}; const int dj[] = {0,-1,0,1}; const double PI=acos(-1); const string tr="abcdefghijklmnopqrstuvwxyz"; #define dame { puts("-1"); return 0;} #define yn {puts("Yes");}else{puts("No");} #define YN {puts("YES");}else{puts("NO");} ll llpow(ll n,ll i){if(i==0){return 1;}ll cnt=n;for(ll j=0;j> pf/*prime_factorize*/(ll n){vector> res;for(ll a=2;a*a<=n;a++){if(n%a!=0) continue;ll ex=0;while(n%a==0){ex++;n/=a;}res.pb({a,ex});}if(n!=1) res.pb({n,1});return res;} vector div/*divisor*/(ll n){ vector res={1};for(ll a=2;a*a<=n;a++){if(n%a!=0) continue;ll b=n/a;res.pb(b);if(b!=a) res.pb(a);}sort(all(res));return res;} struct mint { ll x; // typedef long long ll; mint(ll x=0):x((x%mod+mod)%mod){} mint operator-() const { return mint(-x);} mint& operator+=(const mint a) { if ((x += a.x) >= mod) x -= mod; return *this; } mint& operator-=(const mint a) { if ((x += mod-a.x) >= mod) x -= mod; return *this; } mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;} mint operator+(const mint a) const { return mint(*this) += a;} mint operator-(const mint a) const { return mint(*this) -= a;} mint operator*(const mint a) const { return mint(*this) *= a;} mint pow(ll t) const { if (!t) return 1; mint a = pow(t>>1); a *= a; if (t&1) a *= *this; return a; } // for prime mod mint inv() const { return pow(mod-2);} mint& operator/=(const mint a) { return *this *= a.inv();} mint operator/(const mint a) const { return mint(*this) /= a;} }; istream& operator>>(istream& is, const mint& a) { return is >> a.x;} ostream& operator<<(ostream& os, const mint& a) { return os << a.x;} struct UnionFind { vector d; UnionFind(int n): d(n,-1) {} int root(int x) { if (d[x] < 0) return x; return d[x] = root(d[x]); } bool unite(int x, int y) { x = root(x); y = root(y); if (x == y) return false; if (d[x] > d[y]) swap(x,y); d[x] += d[y]; d[y] = x; return true; } bool same(int x, int y) { return root(x) == root(y);} int size(int x) { return -d[root(x)];} }; mint f2(ll n) {if (n == 0) return 1;mint x = f2(n/2);x *= x;if (n%2 == 1) x *= 2;return x;} mint choose(int n,int a){mint x=1,y=1;rep(i,a){x*=n-i;y*=i+1;}return x/y;} ll xs/*xorsum nまでのxorの和*/(ll n){ll cnt=(n+1)/2;ll ans=cnt%2;if(n%2==0) ans^=n;return ans;} ll Fa/*Factorial nの階乗*/(ll n){ll ans=1;rrep(i,n){ans*=i;}return ans;} int n; double dp[110][110][110]; double solve(int i,int j,int k){ if(i==0&&j==0&&k==0) return 0.0; if(dp[i][j][k]>0) return dp[i][j][k]; double res=0.0; if(i>0) res+=solve(i-1,j,k)*i; if(j>0) res+=solve(i+1,j-1,k)*j; if(k>0) res+=solve(i,j+1,k-1)*k; res+=n; res/=(i+j+k); return dp[i][j][k]=res; } int main(){ cin>>n; int two=0,one=0,zero=0; rep(i,n) { int a;cin>>a; if(a==2) two++; if(a==1) one++; if(a==0) zero++; } memset(dp,-1,sizeof(dp)); printf("%.10f\n",solve(two,one,zero)); return 0; }