from collections import Counter N = int(input()) A = list(map(int, input().split())) need = [max(3-a, 0) for a in A] cnt = Counter(need) # コンプまであと(1,2,3)枚必要なカード数がdp(a, b, c) # ここからdp(0,0,0)にするまでカードを買う回数の期待値 U = 3 * N + 1 dp = [[[0.0] * U for _ in range(U)] for _ in range(U)] for c in range(U): for b in range(U): if c + b > U: break for a in range(U): if c + b + a > U: break if a + b + c == 0: continue E = N p = 0 if a > 0: E += dp[a - 1][b][c] * a p += a if b > 0 and a < N: E += dp[a + 1][b - 1][c] * b p += b if c > 0 and b < N: E += dp[a][b + 1][c - 1] * c p += c dp[a][b][c] = E / p x = cnt[1] y = cnt[2] z = cnt[3] print(dp[x][y][z])