from functools import lru_cache @lru_cache(maxsize=100001) def solve(x,y,z): if x==n and y==n and z==n: return 0 exp = n/(n-z) res = 0 if x != n: res += (solve(x+1,y,z)+exp)*(n-x)/(n-z) if y != x: res += (solve(x,y+1,z)+exp)*(x-y)/(n-z) if z != y: res += (solve(x,y,z+1)+exp)*(y-z)/(n-z) return res n = int(input()) A = list(map(int,input().split())) count = [0,0,0] for i in A: if i >= 1: count[0] += 1 if i >= 2: count[1] += 1 if i >= 3: count[2] += 1 print(solve(count[0],count[1],count[2]))