import java.util.Scanner; public class Main_yukicoder108 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] cards = new int[3]; for (int i = 0; i < n; i++) { int a = sc.nextInt(); if (a >= 3) { cards[2]++; cards[1]++; cards[0]++; } else if (a == 2) { cards[1]++; cards[0]++; } else if (a == 1) { cards[0]++; } } double[][][] dp = new double[n + 1][n + 1][n + 1]; dp[n][n][n] = 0; for (int k = n - 1; k >= 0; k--) { for (int j = n; j >= k; j--) { for (int i = n; i >= j; i--) { if (i == n && j == n) { dp[i][j][k] = (dp[i][j][k + 1] * (j - k) / n + 1) * n / (j - k); } else if (i == n) { dp[i][j][k] = (dp[i][j + 1][k] * (i - j) / n + dp[i][j][k + 1] * (j - k) / n + 1) * n / (i - k); } else { dp[i][j][k] = (dp[i + 1][j][k] * (n - i) / n + dp[i][j + 1][k] * (i - j) / n + dp[i][j][k + 1] * (j - k) / n + 1) * n / (n - k); } } } } System.out.println(dp[cards[0]][cards[1]][cards[2]]); // System.out.println(dp[0][0][0]); sc.close(); } }