output_description: Print the expected number of times the operation is performed before all the
  pieces of sushi are eaten. The output is considered correct when the relative
  difference is not greater than 10^{-9}.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
      a_1 a_2 \ldots a_N
attempt: # -*- coding: utf-8 -*-
  
  import sys
  from collections import Counter
  
  
  def input():
      return sys.stdin.readline().strip()
  
  
  def list2d(a, b, c):
      return [[c] * b for i in range(a)]
  
  
  def list3d(a, b, c, d):
      return [[[d] * c for j in range(b)] for i in range(a)]
  
  
  def list4d(a, b, c, d, e):
      return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
  
  
  def ceil(x, y=1):
      return int(-(-x // y))
  
  
  def INT():
      return int(input())
  
  
  def MAP():
      return map(int, input().split())
  
  
  def LIST(N=None):
      return list(MAP()) if N is None else [INT() for i in range(N)]
  
  
  def Yes():
      print("Yes")
  
  
  def No():
      print("No")
  
  
  def YES():
      print("YES")
  
  
  def NO():
      print("NO")
  
  
  sys.setrecursionlimit(10**9)
  INF = float("inf")
  MOD = 10**9 + 7
  
  N = INT()
  A = LIST()
  C = Counter(A)
  
  # dp[i][j][k] := 3個残りがi個、2個残りがj個、1個残りがk個である状態にするまでの操作回数の期待値
  dp = list3d(N + 1, N + 1, N + 1, INF)
  # 全て残0なら残り回数は0
  dp[0][0][0] = 0.0
  for i in range(N + 1):
      for j in range(N + 1):
          # 枝刈り
          if i + j > N:
              break
          for k in range(N + 1):
              # 枝刈り
              if i + j + k > N:
                  break
              if i == j == k == 0:
                  continue
              # 今現在残っている皿を取る確率
              tmp = (i + j + k) / N
              # そのために必要な回数
              res = 1 / tmp
              # それ以降に必要な回数
              if i and j < N:
                  res += (i / N) / tmp * dp[i - 1][j + 1][k]
              if j and k < N:
                  res += (j / N) / tmp * dp[i][j - 1][k + 1]
              if k:
                  res += (k / N) / tmp * dp[i][j][k - 1]
              dp[i][j][k] = res
  print(dp[C[3]][C[2]][C[1]])
  
problem_description: Statement
  
  There are N dishes, numbered 1, 2, \ldots, N. Initially, for each i (1 \leq i
  \leq N), Dish i has a_i (1 \leq a_i \leq 3) pieces of sushi on it.
  
  Taro will perform the following operation repeatedly until all the pieces of
  sushi are eaten:
  
    * Roll a die that shows the numbers 1, 2, \ldots, N with equal probabilities, and let i be the outcome. If there are some pieces of sushi on Dish i, eat one of them; if there is none, do nothing.
  
  Find the expected number of times the operation is performed before all the
  pieces of sushi are eaten.
samples: [{"input": "3\n    1 1 1", "output": "5.5\n    \n\nThe expected number of operations before the first piece of sushi is eaten, is\n1. After that, the expected number of operations before the second sushi is\neaten, is 1.5. After that, the expected number of operations before the third\nsushi is eaten, is 3. Thus, the expected total number of operations is 1 + 1.5\n+ 3 = 5.5.\n\n* * *"}, {"input": "1\n    3", "output": "3\n    \n\nOutputs such as `3.00`, `3.000000003` and `2.999999997` will also be accepted.\n\n* * *"}, {"input": "2\n    1 2", "output": "4.5\n    \n\n* * *"}, {"input": "10\n    1 3 2 3 3 2 3 2 1 3", "output": "54.48064457488221"}]