### BUGGY CODE ###

import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n = I()
    a = LI()
    t = [0] * 3
    for c in a:
        t[c-1] += 1
    A,B,C = t
    D = C + 1
    E = B + D
    F = A + E

    r = [[[0]*(F-k-j) for j in range(E-k)] for k in range(D)]
    for k in range(D):
        t0 = r[k]
        G = F - k
        for j in range(E-k):
            tj = t0[j]
            if j > 0:
                tm = t0[j-1]
            if k > 0:
                tp = t1[j+1]
            for i in range(G-j):
                if not(i or j or k):
                    continue
                tr = n
                if i > 0:
                    tr += tj[i-1] * i
                if j > 0:
                    tr += tm[i+1] * j
                if k > 0:
                    tr += tp[i] * k
                tj[i] = tr / (i+j+k)
        t1 = t0


    return "{:0.9f}".format(r[C][B][A])


print(main())


### FIXED CODE ###

import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n = I()
    a = LI()
    t = [0] * 3
    for c in a:
        t[c-1] += 1
    A,B,C = t
    D = C + 1
    E = B + D
    F = A + E

    r = [[[0]*(F-k-j) for j in range(E-k)] for k in range(D)]
    for k in range(1):
        z = r[k]
        G = F - k
        for j in range(E-k):
            x = z[j]
            if j > 0:
                m = z[j-1]
            l = k + j
            for i in range(G-j):
                if not(i or l):
                    continue
                w = n
                if i > 0:
                    w += x[i-1] * i
                if j > 0:
                    w += m[i+1] * j
                x[i] = w / (i+l)


    y = r[0]
    for k in range(1, D):
        z = r[k]
        G = F - k

        x = z[0]
        p = y[1]
        x[0] = (n + p[0] * k) / k

        for i in range(1,G):
            x[i] = (n + x[i-1] * i + p[i] * k) / (i+k)

        for j in range(1,E-k):
            x = z[j]
            m = z[j-1]
            p = y[j+1]
            l = j + k
            x[0] = (n + m[1] * j + p[0] * k) / l

            for i in range(1,G-j):
                x[i] = (n + x[i-1] * i + m[i+1] * j + p[i] * k) / (i+l)

        y = z


    return "{:0.9f}".format(r[C][B][A])


print(main())