use std::cmp;
use std::collections::HashMap;
use std::collections::VecDeque;
use std::f64::MAX;

macro_rules! input {(source = $s:expr, $($r:tt)*) => {let mut iter = $s.split_whitespace();let mut next = || { iter.next().unwrap() };input_inner!{next, $($r)*}};($($r:tt)*) => {let stdin = std::io::stdin();let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));let mut next = move || -> String{bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect()};input_inner!{next, $($r)*}};}
macro_rules! input_inner {($next:expr) => {};($next:expr, ) => {};($next:expr, $var:ident : $t:tt $($r:tt)*) => {let $var = read_value!($next, $t);input_inner!{$next $($r)*}};}
macro_rules! read_value {($next:expr, ( $($t:tt),* )) => {( $(read_value!($next, $t)),* )};($next:expr, [ $t:tt ; $len:expr ]) => {(0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()};($next:expr, chars) => {read_value!($next, String).chars().collect::<Vec<char>>()};($next:expr, usize1) => {read_value!($next, usize) - 1};($next:expr, [ $t:tt ]) => {{let len = read_value!($next, usize);(0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()}};($next:expr, $t:ty) => {$next().parse::<$t>().expect("Parse error")};}

fn solve() {
    input! {
        n: usize,
        a: [usize;n]
    }

    let mut ans = 0;

    let mut one = 0;
    let mut two = 0;
    let mut three = 0;
    for i in 0..n {
        if a[i] == 1 {
            one += 1;
        } else if a[i] == 2 {
            two += 1;
        } else if a[i] == 3 {
            three += 1;
        }
    }

    let mut dp = vec![vec![vec![-1.0; n + 1]; n + 1]; n + 1];
    dp[0][0][0] = 0.0;
    fn solve_sushi(dp: &mut Vec<Vec<Vec<f64>>>, i: usize, j: usize, k: usize, n: usize) -> f64 {
        if dp[i][j][k] >= 0.0 {
            return dp[i][j][k];
        }

        let mut result = 0.0;

        if i > 0 {
            result += i as f64 * solve_sushi(dp, i - 1, j, k, n);
        }
        if j > 0 {
            result += j as f64 * solve_sushi(dp, i + 1, j - 1, k, n);
        }
        if k > 0 {
            result += k as f64 * solve_sushi(dp, i, j + 1, k - 1, n);
        }
        result += n as f64;
        result /= i as f64 + j as f64 + k as f64;
        dp[i][j][k] = result;

        return dp[i][j][k];
    };

    println!("{}", solve_sushi(&mut dp, one, two, three, n));
}

fn main() {
    let thd = std::thread::Builder::new().stack_size(104_857_600);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}

// 最大公約数
fn gcd(a: u64, b: u64) -> u64 {
    let mut aa: u64 = if a > b { a } else { b };
    let mut bb: u64 = if a > b { b } else { a };
    while bb != 0 {
        let tmp = bb;
        bb = aa % tmp;
        aa = tmp;
    }
    return aa;
}

// 最小公倍数
fn lcm(a: u64, b: u64) -> u64 {
    a / gcd(a, b) * b
}

// 文字列操作

const LARGE_PRIME: u64 = 1_000_000_007;

fn power_mod(base: u64, exp: u64, modulo: u64) -> u64 {
    if exp == 0 {
        return 1;
    } else if exp & 1 == 0 {
        return (power_mod(base, exp / 2, modulo) % modulo).pow(2) % modulo;
    } else {
        return power_mod(base, exp - 1, modulo) % modulo * base % modulo;
    }
}

fn inverse_mod(element: u64, modulo: u64) -> u64 {
    // フェルマーの小定理からpが素数なら a^(p-1) = 1
    // よってa*a^(p-2) = 1 より a^(p-2)がaの逆元

    power_mod(element, modulo - 2, modulo) % modulo
}

fn combination_mod(m: u64, n: u64, modulo: u64) -> u64 {
    // m C n = m! / ( n! * (m - n)! )
    //       = m*(m-1)*(m-2)*...*(m-n+1)/n!
    //       = m*(m-1)*(m-2)*...*(m-n+1) * (n!)^-1

    let mut numerator = 1;
    for i in 0..n {
        numerator *= m - i;
        numerator %= modulo;
    }

    // n!
    let mut element = 1;
    for j in 1..(n + 1) {
        element *= j;
        element %= modulo;
    }

    numerator * inverse_mod(element, modulo) % modulo
}

fn topological_sort(n: usize, edges: Vec<(usize, usize)>) -> Vec<usize> {
    let mut result = vec![];
    let mut isolated = VecDeque::new();

    // to[x] = [a,b] x -> a, x -> b が存在
    let mut to = vec![vec![]; n + 1];

    // deg[x] = a -> x, b -> xのような辺の数
    let mut deg = vec![0; n + 1];
    for e in edges {
        to[e.0].push(e.1);
        deg[e.1] += 1;
    }

    for i in 1..n + 1 {
        if deg[i] == 0 {
            isolated.push_front(i);
        }
    }

    while isolated.len() != 0 {
        let next = isolated.pop_back().unwrap();
        result.push(next);
        for i in &to[next] {
            deg[*i] -= 1;
            if deg[*i] == 0 {
                isolated.push_front(*i);
            }
        }
    }

    result
}


Measured memory_bytes: 242044