from typing import List, Tuple, Callable, TypeVar import sys import itertools import heapq import bisect import math from collections import deque, defaultdict, Counter from functools import lru_cache, cmp_to_key input = sys.stdin.readline if __file__ != 'prog.py': sys.setrecursionlimit(10 ** 6) def readints(): return map(int, input().split()) def readlist(): return list(readints()) def readstr(): return input()[:-1] N = int(input()) A = readlist() cnt = defaultdict(int) for a in A: cnt[a] += 1 @lru_cache(None) def solve(a, b, c): if a + b + c == 0: return 0 acc = 0 if a: acc += a * solve(a - 1, b + 1, c) if b: acc += b * solve(a, b - 1, c + 1) if c: acc += c * solve(a, b, c - 1) return (acc + N) / (a + b + c) print(solve(cnt[0], cnt[1], cnt[2]))