function StirlingNumberOf2ndKind (N,k)
{
	SN  :< 1e300;
	kF	:< 1e300;
	CF  :< 1e300;
	
	SN  = 0;
	kF  = 1;
	m1t = 1;
	CF	= 1;
	
	for (i=0; i<k; i=i+1)
	{
		SN = SN + m1t*CF*(k-i)^N;
		m1t = -m1t;
		CF	= CF * (k-i)/(i+1);
		kF = kF*(i+1);
	}
	
	return SN/kF;
}

fprintf (stdout, "Model Dimension: ");
fscanf  (stdin, "Number", modelD);

maxParameterCount = modelD*(modelD-1)/2;

fprintf (stdout, "\nMaximum number of rate parameters is ", maxParameterCount,
				 "\n\n\nRates                   Models\n");
totalModelCount = 0;

for (rc = 1; rc <= maxParameterCount; rc = rc+1)
{
	SNr = StirlingNumberOf2ndKind (maxParameterCount,rc);
	fprintf (stdout, Format(rc,5,0),Format (SNr, 25, 0), "\n");
	totalModelCount = totalModelCount + SNr;
}

fprintf (stdout, "\n\nTotal model count: ", Format(totalModelCount,15,0), "\n");
