#include <vector>
#include "utilities_all_classes.hpp"
static const int Nbuf= 100;
static const int factr[10] = { 1, 1,	2,	6,	24,	120,	720,	5040,	40320	,362880}; 
class Permute
{
public:
	std::vector<int> P;
	Int2Vec perms;
	std::vector<int> ma;
	std::vector<int> aa; 	
	int N;
	int t;
	int count;
	Permute(std::vector<int> a_in)
	{
		
		count=0;
		N=(int)a_in.size();
		ma.reserve(20);
		aa.reserve(20);
		ma.push_back(1);
		t=0;
		P.resize(N);
		P[0]=0;
		aa.push_back(a_in[0]);
		for(int i=1;i<N;i++)
		{
			P[i]=0;
			if(a_in[i]!=a_in[i-1])
			{
				aa.push_back(a_in[i]);
				ma.push_back(1);
				t++;
			}
			else
				ma[t]++;
		}
		int nperm_size=factorial(N);
		for(int i=0;i<=t;i++)
			nperm_size/=factorial(ma[i]);
		perms.resize(nperm_size);
	}
void GenMult(int n);
void printP() ;
int factorial(int n);
};