#include <iostream>
#include <vector>
#include <algorithm>
#include <limits>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
#define mod 1000000007
const int MX = 305;

int main() {
	/*int N;
	cin >> N;
	vector<int>h(N);
	int i;
	for (i = 0; i < N; i++) {
		cin >> h[i];
	}
	vector<int>c(N);
	c[0] = 0;
	c[1] = abs(h[1]-h[0]);
	for (i = 1; i < N - 1; i++) {
		c[i + 1] = min(c[i] + abs(h[i + 1] - h[i]), c[i - 1] + abs(h[i + 1] - h[i - 1]));
	}
	cout << c[N - 1] << endl;*/



	/*int N, K;
	cin >> N >> K;
	vector<int>h(N);
	int i, j;

	for (i = 0; i < N; i++) {
		cin >> h[i];
	}
	vector<int>c(N);
	c[0] = 0;
	c[1] = abs(h[1] - h[0]);
	for (i = 1; i < N - 1; i++) {
		c[i + 1] = c[i] + abs(h[i + 1] - h[i]);
		for (j = 1; j <= K && i + 1 - j >= 0; j++) {
			c[i + 1] = min(c[i + 1], c[i + 1 - j] + abs(h[i + 1] - h[i + 1 - j]));
		}
	}
	cout << c[N - 1] << endl;*/


	/*int N;
	cin >> N;
	vector<int>a(N), b(N), c(N);
	int i;
	for (i = 0; i < N; i++) {
		cin >> a[i] >> b[i] >> c[i];
	}
	vector<int>A(N), B(N), C(N);
	A[0] = a[0];
	B[0] = b[0];
	C[0] = c[0];
	for (i = 0; i < N - 1; i++) {
		A[i + 1] = a[i + 1] + max(B[i], C[i]);
		B[i + 1] = b[i + 1] + max(A[i], C[i]);
		C[i + 1] = c[i + 1] + max(A[i], B[i]);
	}
	cout << max({ A[N - 1], B[N - 1],C[N - 1] }) << endl;*/


	/*int N, W;
	cin >> N >> W;
	int i, j;
	vector<int>w(N + 1), v(N + 1);
	for (i = 0; i < N; i++) {
		cin >> w[i + 1] >> v[i + 1];
	}
	vector<vector<long long>>dp(N + 1, vector<long long>(W + 1));
	for (i = 0; i < N; i++) {
		for (j = 0; j <= W; j++) {
			if (j - w[i + 1] >= 0)dp[i + 1][j] = max(dp[i][j], dp[i][j - w[i + 1]] + v[i + 1]);
			else dp[i + 1][j] = dp[i][j];
		}
	}
	cout << dp[N][W] << endl;*/


	/*long long N, W;
	cin >> N >> W;
	vector<long long>dp(100005);
	int w, v, i, j;
	for (i = 0; i <= 100004; i++)dp[i] = 1e10;
	dp[0] = 0;
	for (i = 0; i < N; i++) {
		cin >> w >> v;
		for (j = 100004; j >= v; j--) {
			dp[j] = min(dp[j], dp[j - v] + w);
		}
	}
	long long ans = 0;
	for (i = 0; i <= 100004; i++) {
		if (W >= dp[i]) {
			ans = i;
		}
	}
	cout << ans;*/          //E


	/*string s, t;
	cin >> s >> t;
	vector<vector<int>>dp(3005, vector<int>(3005));
	int i, j;
	for (i = 0; i < s.size() - 1; i++) {
		for (j = 0; j < t.size() - 1; j++) {
			dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
			dp[i][j + 1] = max(dp[i][j + 1], dp[i][j]);
			if (s[i] == t[j])dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j] + 1);
		}
	}
	cout << dp[s.size()][t.size()] << endl;*/                   //F


	//int N, M;
	//cin >> N >> M;                   //G


	/*int H, W;
	cin >> H >> W;
	vector<vector<char>>a(H + 1, vector<char>(W + 1));
	vector<vector<int>>dp(H + 1, vector<int>(W + 1));
	int i, j;
	dp[1][1] = 1;
	for (i = 1; i <= H; i++) {
		for (j = 1; j <= W; j++) {
			cin >> a[i][j];
			if (a[i][j] == '.') {
				dp[i][j] += (dp[i - 1][j] + dp[i][j - 1]) % mod;
			}
			else {
				dp[i][j] = 0;
			}
		}
	}
	cout << dp[H][W];*/           //H


	/*int N;
	cin >> N;
	int i, j;
	double p;
	vector<vector<double>>dp(N + 1, vector<double>(N + 1));
	for (i = 1; i <= N; i++) {
		cin >> p;
		if (i == 1) {
			dp[1][1] = p;
			dp[1][0] = 1 - p;
			continue;
		}
		for (j = 0; j < i; j++) {
			if (j == 0) {
				dp[i][0] = dp[i - 1][0] * (1 - p);
			}
			dp[i][j + 1] = dp[i - 1][j] * p + dp[i - 1][j + 1] * (1 - p);
		}
	}
	double ans = 0;
	for (i = N / 2 + 1; i <= N; i++) {
		ans += dp[N][i];
	}
	printf("%.10f", ans);*/       //I    

	int N;
	cin >> N;
	vector<int>a(4);
	int i, A;
	for (i = 1; i <= N; i++) {
		cin >> A;
		a[A]++;
	}

	double p = 1.0 / N;
	static double dp[MX][MX][MX];
	rep(k, N + 1)rep(j, N + 1)rep(i, N + 1) {
		int z = N - i - j - k;
		if (z < 0)break;
		if (z == N)continue;
		double x = 1 - z * p;
		if (i)dp[i][j][k] += dp[i - 1][j][k] * i * p;
		if (j)dp[i][j][k] += dp[i + 1][j - 1][k] * j * p;
		if (k)dp[i][j][k] += dp[i][j + 1][k - 1] * k * p;
		dp[i][j][k] += 1;
		dp[i][j][k] /= x;
	}
	printf("%.10f", dp[a[1]][a[2]][a[3]]);
	return 0;

}

Measured memory_bytes: 219392