local n=io.read("n")
local a={1,1,1}
for i=1,n do
    local input=io.read("n")
    a[input]=a[input]+1
end

local dp={}
for i=1,n+1 do
    dp[i]={}
    for j=1,n+1 do
        dp[i][j]={}
        for k=1,n+1 do
            dp[i][j][k]=-1
        end
    end
end


local function solve(i,j,k)
    if dp[i][j][k]>=0 then
        return dp[i][j][k]
    end
    if i==1 and j==1 and k==1 then
        return 0
    end
    local total=0
    if i>1 then
        total=total+solve(i-1,j,k)*(i-1)
    end
    if n+1>i and j>1 then
        total=total+solve(i+1,j-1,k)*(j-1)
    end
    if n+1>j and k>1 then
        total=total+solve(i,j+1,k-1)*(k-1)
    end
    total=total+n
    total=total*(1/(i+j+k-3))
    
    dp[i][j][k]=total
    return dp[i][j][k]
end

print(solve(a[1],a[2],a[3]))