using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;

namespace EDP_J
{
    class Program
    {
        static double solvedp(double[,,] dp, int n, int i, int j, int k)
        {
            if (dp[i, j, k] >= 0) return dp[i, j, k];
            if ((i + j + k) == 0) return 0;

            var ans = 0.0;
            if (i > 0) ans += solvedp(dp, n, i - 1, j, k) * i;
            if (j > 0) ans += solvedp(dp, n, i + 1, j - 1, k) * j;
            if (k > 0) ans += solvedp(dp, n, i, j + 1, k - 1) * k;

            ans += n;
            ans *= 1.0 / (i + j + k);

            dp[i, j, k] = ans;

            return ans;
        }

        static double[,,] solvedp(List<int> nums)
        {
            var n = nums.Count();

            // 残数が同じ皿は、同一視してよく、上限が3貫と決まっているので
            // 3変数に集約できる
            // [i, j, k]: 残り1貫の皿がi枚～残り3貫の皿がk枚の状態から
            // お寿司をすべてなくすために必要な操作回数の期待値
            var dp = new double[n + 1, n + 1, n + 1];
            for (int i = 0; i < dp.GetLength(0); i++)
            {
                for (int j = 0; j < dp.GetLength(1); j++)
                {
                    for (int k = 0; k < dp.GetLength(2); k++)
                    {
                        dp[i, j, k] = -1;
                    }
                }
            }

            solvedp(dp, n,
                nums.Count(x => x == 1),
                nums.Count(x => x == 2),
                nums.Count(x => x == 3));

            return dp;
        }

        static void Solve()
        {
            var n = Input.NextInt();
            var a = Input.NextInt(n);

            var dp = solvedp(a);

            var ans = dp[a.Count(x => x == 1),
                a.Count(x => x == 2),
                a.Count(x => x == 3)];

            Console.WriteLine($"{ans:F10}");
        }

        #region Competitive Template
        public static void Main(string[] args)
        {
            var needsFlushOutput = true;
            if (needsFlushOutput)
            {
                // 細かく出力しないようにする
                var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
                Console.SetOut(sw);
            }

            // 仮想的に標準入力をセットする
            // NextLine系を使っていると使えない
            //Input.SetText("");

            Solve();

            Console.Out.Flush();
        }

        static class Input
        {
            static char[] separator = { ' ' };
            public static bool IsEof { get; set; }
            static Queue<string> q { get; set; }

            static Input()
            {
                IsEof = false;
                q = new Queue<string>();
            }

            /// <summary>
            /// 入力予約
            /// </summary>
            /// <param name="items"></param>
            public static void SetText(IEnumerable<string> items)
            {
                foreach (var item in items)
                {
                    SetText(item);
                }
            }

            /// <summary>
            /// 入力予約
            /// </summary>
            /// <param name="s"></param>
            /// <returns></returns>
            public static bool SetText(string s)
            {
                if (s == null) return false;

                foreach (var elem in s.Trim().Split(separator, StringSplitOptions.RemoveEmptyEntries))
                {
                    q.Enqueue(elem);
                }

                return true;
            }

            /// <summary>
            /// 内部queueに入力からの値をsplitして格納する
            /// </summary>
            /// <returns></returns>
            static bool read()
            {
                var s = Console.ReadLine();
                if (s == null) return false;

                foreach (var elem in s.Trim().Split(separator, StringSplitOptions.RemoveEmptyEntries))
                {
                    q.Enqueue(elem);
                }

                if (!q.Any()) return read();

                return true;
            }

            /// <summary>
            /// 次のstringを一つ読み込む
            /// </summary>
            /// <returns></returns>
            public static string Next()
            {
                if (!q.Any())
                {
                    if (!read())
                    {
                        IsEof = true;
                        return "";
                    }
                }

                return q.Dequeue();
            }

            public static int NextInt() => int.Parse(Next());
            public static long NextLong() => long.Parse(Next());
            public static double NextDouble() => double.Parse(Next());

            public static List<string> Next(int n) => Enumerable.Range(0, n).Select(_ => Next()).ToList();
            public static List<int> NextInt(int n) => Next(n).Select(x => int.Parse(x)).ToList();
            public static List<long> NextLong(int n) => Next(n).Select(x => long.Parse(x)).ToList();
            public static List<double> NextDouble(int n) => Next(n).Select(x => double.Parse(x)).ToList();

            public static List<string> NextLine() => Console.ReadLine().Trim().Split(separator, StringSplitOptions.RemoveEmptyEntries).ToList();
            public static List<int> NextIntLine() => NextLine().Select(x => int.Parse(x)).ToList();
            public static List<long> NextLongLine() => NextLine().Select(x => long.Parse(x)).ToList();
            public static List<double> NextDoubleLine() => NextLine().Select(x => double.Parse(x)).ToList();
        }
        #endregion
    }
}


Measured memory_bytes: 224596