n = gets.to_i

a = gets.split.map(&:to_i)
a1 = a.count(1)
a2 = a.count(2)
a3 = a.count(3)

m = a2 + a3
d = Array.new(m+1) {Array.new(n+1, 0.0)}
u = Array.new(m+1) {Array.new(n+1, 0.0)}

(a3+1).times do |c3|
    (m-c3+1).times do |c2|
        (n-c2-c3+1).times do |c1|
            t = c1 + c2 + c3
            next if t == 0
            s = n.to_f
            s += u[c2][c1-1] * c1 if c1 > 0
            s += u[c2-1][c1+1] * c2 if c2 > 0
            s += d[c2+1][c1] * c3 if c3 > 0
            u[c2][c1] = s / t
        end
    end
    d, u = u, d
end

p d[a2][a1]