#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <functional>
#include <complex>
#include <queue>
#include <stack>
#include <cmath>
#include <cassert>
#include <cstring>
using namespace std;
typedef long long LL;
typedef complex<double> CMP;

class MafiaGame { public:
	double probabilityToLose(int N, vector <int> decisions) 
	{
		vector<int> vc;
		{
			map<int,int> voteCnt;
			for(int i=0; i<decisions.size(); ++i)
				voteCnt[decisions[i]] ++;
			for(map<int,int>::iterator it=voteCnt.begin(); it!=voteCnt.end(); ++it)
				vc.push_back( it->second );
		}
		const int MAX = *max_element(vc.begin(), vc.end());
		if( MAX == 1 )
			return 0.0;

		const int GotMAX = count(vc.begin(), vc.end(), MAX);
		for(int k=GotMAX; k; k=(N-k*MAX)%k)
			if( k == 1 )
				return 1.0/GotMAX;
		return 0.0;
	}
};

// BEGIN CUT HERE
#include <ctime>
double start_time; string timer()
 { ostringstream os; os << " (" << int((clock()-start_time)/CLOCKS_PER_SEC*1000) << " msec)"; return os.str(); }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v)
 { os << "{ ";
   for(typename vector<T>::const_iterator it=v.begin(); it!=v.end(); ++it)
   os << '\"' << *it << '\"' << (it+1==v.end() ? "" : ", "); os << " }"; return os; }
void verify_case(const double& Expected, const double& Received) {
 bool ok = (abs(Expected - Received) < 1e-9);
 if(ok) cerr << "PASSED" << timer() << endl;  else { cerr << "FAILED" << timer() << endl;
 cerr << "\to: \"" << Expected << '\"' << endl << "\tx: \"" << Received << '\"' << endl; } }
#define CASE(N) {cerr << "Test Case #" << N << "..." << flush; start_time=clock();
#define END	 verify_case(_, MafiaGame().probabilityToLose(N, decisions));}
int main(){

CASE(0)
	int N = 3; 
	int decisions_[] = {1, 1, 1};
	  vector <int> decisions(decisions_, decisions_+sizeof(decisions_)/sizeof(*decisions_)); 
	double _ = 1.0; 
END
CASE(1)
	int N = 5; 
	int decisions_[] = {1, 2, 3};
	  vector <int> decisions(decisions_, decisions_+sizeof(decisions_)/sizeof(*decisions_)); 
	double _ = 0.0; 
END
CASE(2)
	int N = 20; 
	int decisions_[] = {1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7, 18, 19, 0};
	  vector <int> decisions(decisions_, decisions_+sizeof(decisions_)/sizeof(*decisions_)); 
	double _ = 0.0; 
END
CASE(3)
	int N = 23; 
	int decisions_[] = {17, 10, 3, 14, 22, 5, 11, 10, 22, 3, 14, 5, 11, 17};
	  vector <int> decisions(decisions_, decisions_+sizeof(decisions_)/sizeof(*decisions_)); 
	double _ = 0.14285714285714285; 
END
/*
CASE(4)
	int N = ; 
	int decisions_[] = ;
	  vector <int> decisions(decisions_, decisions_+sizeof(decisions_)/sizeof(*decisions_)); 
	double _ = ; 
END
CASE(5)
	int N = ; 
	int decisions_[] = ;
	  vector <int> decisions(decisions_, decisions_+sizeof(decisions_)/sizeof(*decisions_)); 
	double _ = ; 
END
*/
}
// END CUT HERE
