#include #include #include using namespace std; #define REP(i,m,n) for(int i=(m);i<(n);i++) #define rep(i,n) REP(i,0,n) #define pb push_back #define all(a) a.begin(),a.end() #define rall(c) (c).rbegin(),(c).rend() #define mp make_pair #define double long double typedef long long ll; typedef pair pii; typedef pair pll; const ll inf=1e9+7; const ll mod=1e9+7; ll n; vector > >dp(110,vector >(110,vector(110))); vectorcnt(4); double solve(ll x,ll y,ll z){ if(dp[x][y][z]!=-1)return dp[x][y][z]; dp[x][y][z]=0; double k=1.0*n/(n-z); if(x!=n)dp[x][y][z]+=(solve(x+1,y,z)+k)*(n-x)/(n-z); if(x!=y)dp[x][y][z]+=(solve(x,y+1,z)+k)*(x-y)/(n-z); if(y!=z)dp[x][y][z]+=(solve(x,y,z+1)+k)*(z-y)/(n-z); return dp[x][y][z]; } int main(){ cin>>n; rep(i,n+1)rep(j,n+1)rep(k,n+1)dp[i][j][k]=-1; rep(i,n){ ll a;cin>>a; cnt[min(a,3LL)]++; } for(int i=2;i>=0;i--){ cnt[i]+=cnt[i+1]; } dp[n][n][n]=0; cout<