import sys from functools import lru_cache sys.setrecursionlimit(10**7) def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int,sys.stdin.readline().rstrip().split()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LI2(): return list(map(int,sys.stdin.readline().rstrip())) def S(): return sys.stdin.readline().rstrip() def LS(): return list(sys.stdin.readline().rstrip().split()) def LS2(): return list(sys.stdin.readline().rstrip()) N = I() A = LI() x,y,z = 0,0,0 for a in A: if a == 0: x += 1 elif a == 1: y += 1 elif a == 2: z += 1 @lru_cache(maxsize=None) def dp(i,j,k): # 0,1,2枚集まっているカードがi,j,k種類ある状態での期待値 if i < 0 or j < 0 or k < 0: return 0 if i == j == k == 0: return 0 return (i*dp(i-1,j+1,k)+j*dp(i,j-1,k+1)+k*dp(i,j,k-1)+N)/(i+j+k) print(dp(x,y,z))