#[allow(unused_macros)]
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)*}
    };
}
 
#[allow(unused_macros)]
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)*}
    };
}
 
#[allow(unused_macros)]
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, bytes) => {
        read_value!($next, String).into_bytes()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
 
use std::cmp::Ordering;
use std::cmp;
use std::cmp::min;
use std::collections::BTreeMap;
use std::process;
use std::cmp::Ord;
use std::collections::HashMap;
use std::collections::HashSet;
use std::collections::VecDeque;
use std::collections::BTreeSet;
use std::mem;

/// Equivalent to std::lowerbound and std::upperbound in c++
pub trait BinarySearch<T> {
    fn lower_bound(&self, &T) -> usize;
    fn upper_bound(&self, &T) -> usize;
}
 
impl<T: Ord> BinarySearch<T> for [T] {
    fn lower_bound(&self, x: &T) -> usize {
        let mut low = 0;
        let mut high = self.len();
 
        while low != high {
            let mid = (low + high) / 2;
            match self[mid].cmp(x) {
                Ordering::Less => {
                    low = mid + 1;
                }
                Ordering::Equal | Ordering::Greater => {
                    high = mid;
                }
            }
        }
        low
    }
 
    fn upper_bound(&self, x: &T) -> usize {
        let mut low = 0;
        let mut high = self.len();
 
        while low != high {
            let mid = (low + high) / 2;
            match self[mid].cmp(x) {
                Ordering::Less | Ordering::Equal => {
                    low = mid + 1;
                }
                Ordering::Greater => {
                    high = mid;
                }
            }
        }
        low
    }
}
 
fn matmul(A:&Vec<Vec<i64>>, B:&Vec<Vec<i64>>) -> Vec<Vec<i64>>{
    let mut C = vec![vec![0;B[0].len()];A.len()];
    for i in 0..A.len(){
        for k in 0..B.len(){
            for j in 0..B[0].len(){
                C[i][j] += A[i][k]*B[k][j];
                C[i][j] %= MOD;
            }
        }
    }
    return C;
}
fn matpow(A:&mut Vec<Vec<i64>>, n:usize) -> Vec<Vec<i64>>{
    let mut B = vec![vec![0;A.len()];A.len()];
    for i in 0..A.len(){
        B[i][i] = 1;
    }
    let mut n = n;
    let mut tmp = A.clone();
    while(n>0){
        if n&1 == 1{B = matmul(&B, &tmp);}
        tmp = matmul(&tmp, &tmp);
        n>>=1;
    }
    return B;
}

 
 
 

/*
subset enumeration
let mut set;
let mut subset = set;
        for sm2 in 0..1<<n{
            if subset==0{
                break;
            }

            hogehoge


            subset = (subset-1)&set;
        }
*/
/*
全方位木
    fn dfs(s:usize,bef:usize,m:i64, g:&Vec<Vec<usize>>, dp:&mut Vec<Vec<i64>>)->i64{
        let mut res = 1;
        for i in 0..g[s].len(){
            let e = g[s][i];
            if e != bef{
                dp[s][i] = dfs(e, s, m, g, dp);
                res *= (1 + dp[s][i]);
                res %= m;
            }
        }
        return res;
    }
    let tmp = dfs(0, n, m, &g, &mut dp);
    fn dfs2(s:usize, bef:usize, p:i64, m:i64, g:&Vec<Vec<usize>>, dp:&mut Vec<Vec<i64>>){
        for i in 0..g[s].len(){
            let e = g[s][i];
            if e == bef{dp[s][i] = p;}
        }
        let mut L = vec![0;g[s].len()];
        let mut R = vec![0;g[s].len()];

        for i in 0..g[s].len(){
            L[i] = {
                let mut tmp = 1+dp[s][i];
                tmp %= m;
                if i != 0{
                    tmp *= L[i-1];
                }
                tmp%m
            }
        }

        for i in (0..g[s].len()).rev(){
            if i+1<g[s].len(){
                R[i] = (R[i+1]*((1+dp[s][i])%m))%m;
            }
            else{
                R[i] = (1+dp[s][i])%m;
            }

            if g[s][i] == bef{
                continue;
            }  
            let mut tmp = 1;
            if i != 0{
                tmp *= L[i-1];
                tmp %= m;
            }
            if i+1 != g[s].len(){
                tmp *= R[i+1];
                tmp %= m;
            }
            dfs2(g[s][i], s, tmp, m, g, dp);
        }
    }

    */
fn mpow(x:i64, n:i64) -> i64{
    let mut ans = 1;
    let mut n = n;
    let mut x = x;
    while(n != 0){
        if (n&1 == 1){ans = ans*x%MOD;}
        x = x*x%MOD;
        n = n>>1;
    }
    ans
}
fn comb(a:i64, b:i64, fac:&Vec<i64>, ifac:&Vec<i64>) -> i64{
    if a == 0 && b == 0{return 1;}
    if a<b || a<0 {return 0;}
    let mut tmp = ifac[(a-b) as usize]*ifac[b as usize] %MOD;
    return tmp*fac[a as usize] %MOD;
}
pub static MOD:i64 = 1000000007;
const INF: i64 = 1 << 60;
fn main(){
    input!{
        n:usize,
        a:[usize;n],
    }
    let mut count = vec![0;3];
    for i in 0..n{
        count[a[i]-1] += 1;
    }
    let mut dp = vec![vec![vec![-1.0;301];301];301];
    fn dfs(n:f64, c1:usize, c2:usize, c3:usize, dp:&mut Vec<Vec<Vec<f64>>>)->f64{
        if dp[c1][c2][c3] >=0.0{return dp[c1][c2][c3];}
        dp[c1][c2][c3] = 0.0;
        if (c1 == 0 && c2 == 0 && c3 == 0){
            return 0.0;
        }
        if c1 != 0{
            dp[c1][c2][c3] += dfs(n, c1-1, c2, c3, dp)*(c1 as f64);
        }
        if c2 != 0{
            dp[c1][c2][c3] += dfs(n, c1+1, c2-1, c3, dp)*(c2 as f64);
        }
        if c3 != 0{
            dp[c1][c2][c3] += dfs(n, c1, c2+1, c3-1, dp)*(c3 as f64);
        }
        dp[c1][c2][c3] += n;
        dp[c1][c2][c3] *= 1.0/((c1+c2+c3) as f64);
        return dp[c1][c2][c3];


        
    }
    println!("{}", dfs(n as f64, count[0], count[1], count[2], &mut dp));


}




Measured memory_bytes: 237948