#include <bits/stdc++.h>
#define INPUT_FILE "./io/test.in"
constexpr bool Interactive = false;
// Author: Narut Sereewattanawoot
#pragma region
using namespace std;
namespace Narut {
template <class T> using TupleSize = tuple_size<remove_cv_t<remove_reference_t<T>>>;

template <class, class = void> struct IsIterable : false_type {};
template <class T>
struct IsIterable<T, decltype((void)std::begin(declval<T &>()))> : true_type {};

template <class, class = void> struct IsTuple : false_type {};
template <class T> struct IsTuple<T, decltype((void)TupleSize<T>::value)> : true_type {};

template <class Os, Os os, char TupleSep = ' ', char TupleEnd = '\n'> struct Writer {
  template <class, class = void> struct IsDefault : false_type {};
  template <class T>
  struct IsDefault<T, decltype((void)(os << declval<T &>()))> : true_type {};
  template <class, class = void> struct Space { static constexpr char value = ' '; };
  template <class T>
  struct Space<T, enable_if_t<!IsDefault<T>::value and IsIterable<T>::value>> {
    static constexpr char value = '\n';
  };
  template <class T>
  struct Space<
      T, enable_if_t<!IsDefault<T>::value and !IsIterable<T>::value and IsTuple<T>::value>> {
    static constexpr char value = TupleEnd;
  };
  template <class T> static auto Write(const T &t) -> enable_if_t<IsDefault<T>::value> {
    os << t;
  }
  template <class T>
  static auto Write(const T &t) -> enable_if_t<!IsDefault<T>::value and IsIterable<T>::value> {
    using std::begin;
    using std::end;
    auto it = begin(t);
    if (it != end(t))
      Write(*it++);
    while (it != end(t)) {
      os << Space<decltype(*it)>::value;
      Write(*it++);
    }
  }
  template <class T> static void WriteTuple(const T &t, index_sequence<>) {}
  template <class T, size_t I, size_t... Is>
  static void WriteTuple(const T &t, index_sequence<I, Is...>) {
    Write(get<0>(t));
    (void)(int[]){0, (Write(TupleSep), Write(get<Is>(t)), 0)...};
  }
  template <class T>
  static auto Write(const T &t)
      -> enable_if_t<!IsDefault<T>::value and !IsIterable<T>::value and IsTuple<T>::value> {
    WriteTuple(t, make_index_sequence<TupleSize<T>::value>{});
  }
  auto operator()() const {
    if (Interactive)
      os << endl;
    else
      os << '\n';
    return *this;
  }
  template <class First, class... Args>
  auto operator()(const First &f, const Args &... args) const {
    Write(f);
    (void)(int[]){0, (os << ' ', Write(args), 0)...};
    return (*this)();
  }
};

template <istream &is> struct Reader {
  template <class, class = void> struct IsDefault : false_type {};
  template <class T>
  struct IsDefault<T, decltype((void)(is >> declval<T &>()))> : true_type {};
  template <class T> static auto Read(T &t) -> enable_if_t<IsDefault<T>::value> { is >> t; }
  template <class T>
  static auto Read(T &t) -> enable_if_t<!IsDefault<T>::value and IsIterable<T>::value> {
    for (auto &&x : t)
      Read(x);
  }
  template <class T, size_t... Is> static void TupleRead(T &t, index_sequence<Is...>) {
    (void)(int[]){0, (Read(get<Is>(t)), 0)...};
  }
  template <class T>
  static auto Read(T &t)
      -> enable_if_t<!IsDefault<T>::value and !IsIterable<T>::value and IsTuple<T>::value> {
    TupleRead(t, make_index_sequence<TupleSize<T>::value>{});
  }
  template <class T> auto operator()(T &t) const {
    Read(t);
    return *this;
  }
  template <class T> auto operator()(T &t, int n) const {
    t.resize(n);
    Read(t);
  }
  template <class T> operator T() const {
    T t;
    Read(t);
    return t;
  }
};

template <class T> struct Vec1 : vector<T> {
  static constexpr int start_index = 1;
  using vector<T>::vector;
  decltype(auto) operator[](int i) { return vector<T>::operator[](i - 1); }
  decltype(auto) operator[](int i) const { return vector<T>::operator[](i - 1); }
  decltype(auto) at(int i) { return vector<T>::at(i - 1); }
  decltype(auto) at(int i) const { return vector<T>::at(i - 1); }
};

template <class T, int N, int... Ns>
struct Arr : Arr<Arr<T, Ns...>, N> {
  using Arr<Arr<T,Ns...>,N>::Arr;
  void FillAll(const T& t) { for (auto &a: *this) a.FillAll(t); }
};

template <class T, int N>
struct Arr<T,N> : std::array<T,N> {
  constexpr Arr() : std::array<T,N> {} {}
  constexpr Arr(std::initializer_list<T> lst) : std::array<T,N> {} {
    int i = 0; for (auto&& a : lst) std::array<T,N>::at(i++) = a;
  }
  constexpr Arr(const std::array<T,N> &other) : std::array<T,N>(other) {}
  constexpr Arr(std::array<T,N>&& other) : std::array<T,N>(std::move(other)) {}
  void FillAll(const T& t) { std::array<T,N>::fill(t); }
};

template <class T, class = void> struct Greater {
  constexpr bool operator()(const T &lhs, const T &rhs) const { return rhs < lhs; }
};
template <class T>
struct Greater<T, decltype((void)(declval<T &>() > declval<T &>()))> : greater<T> {};
template <class T> using MaxPQ = priority_queue<T>;
template <class T> using MinPQ = priority_queue<T, vector<T>, Greater<T>>;

struct Infinity {
  template <class T> constexpr operator T() const { return numeric_limits<T>::max(); }
};

struct BigNumber {
  template <class T> constexpr operator T() const {
    T x = 0, mask = 0x3f;
    for (int i = 0; i < sizeof(T); i++)
      x |= mask << 8 * i;
    return x;
  }
};

#ifdef NARUT_LOCAL
struct CerrRed {
  template <typename T>
  auto operator<<(const T &t) const -> decltype((void)(cerr << t), *this) {
    cerr << "\033[0;31m" << t << "\033[0m";
    return *this;
  }
  CerrRed operator<<(ostream &(*f)(ostream &)) const {
    cerr << f;
    return *this;
  }
} Cerr;
Writer<CerrRed &, Cerr, ':', ' '> Debug;
#else
struct DoNothing {
  template <class... Args> auto operator()(Args &&...) const { return *this; }
} Debug;
#endif

namespace Export {
Writer<ostream &, cout> Cout;
Reader<cin> Cin;
using Narut::Debug;
using Narut::MaxPQ;
using Narut::MinPQ;
Narut::Infinity Inf;
Narut::BigNumber Big;
using ll = long long;

using Pii = pair<int, int>;
using Vi = vector<int>;
using Vl = vector<ll>;
using Vc = vector<char>;
using Narut::Vec1;
using Narut::Arr;
} // namespace Export

struct IO {
  IO() {
#ifdef NARUT_LOCAL
    if (!Interactive and !freopen(INPUT_FILE, "r", stdin))
      Export::Debug("freopen failed");
    cerr << fixed << setprecision(10);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
  }
} FASTIO{};
} // namespace Narut
using namespace Narut::Export;
#pragma endregion


Arr<double,301,301,301> dp;

int n;

double DFS(int r1, int r2, int r3) {
  if (r1 == 0 and r2 == 0 and r3 == 0) return 0;
  if (dp[r1][r2][r3] != -1) return dp[r1][r2][r3];
  double p1 = r1*1.0/n, p2 = r2*1.0/n, p3 = r3*1.0/n;
  double res1, res2, res3;
  if (r1 > 0) res1 = DFS(r1-1, r2, r3);
  else res1 = 0;
  if (r2 > 0) res2 = DFS(r1+1, r2-1, r3);
  else res2 = 0;
  if (r3 > 0) res3 = DFS(r1, r2+1, r3-1);
  else res3 = 0;
  return dp[r1][r2][r3] = (1+p1*res1+p2*res2+p3*res3)/(p1+p2+p3);
}

auto Run()
{
  cin>>n;
  Arr<int, 3> cnt;
  for (int i = 0; i < n; i++) {
    cnt[(int)Cin-1]++;
  }
  dp.FillAll(-1);
  cout << DFS(cnt[0],cnt[1],cnt[2]);     
}

int main() {
  Run();
}


Measured memory_bytes: 213376